add a clause to Canonicalize for (a :<|> b) :> c with the obvious definition

This commit is contained in:
Alp Mestanogullari 2015-03-10 12:08:17 +01:00
parent 6af9b9e70f
commit 6909b54367
2 changed files with 4 additions and 1 deletions

View File

@ -91,7 +91,8 @@ import Servant.Utils.Links (HasLink (..), IsElem, IsElem',
-- i.e distributing all ':>'-separated bits into the subsequent ':<|>'s.
type family Canonicalize api :: * where
-- requires UndecidableInstances
Canonicalize (a :> (b :<|> c)) = ((a :> Canonicalize b) :<|> (a :> Canonicalize c))
Canonicalize (a :> (b :<|> c)) = a :> Canonicalize b :<|> a :> Canonicalize c
Canonicalize ((a :<|> b) :> c) = a :> Canonicalize c :<|> b :> Canonicalize c
Canonicalize (a :> b) = Redex b (Canonicalize b) a
Canonicalize (a :<|> b) = Canonicalize a :<|> Canonicalize b
Canonicalize a = a

View File

@ -55,6 +55,8 @@ module Servant.API.ContentTypes
, AcceptHeader(..)
, AllCTRender(..)
, AllCTUnrender(..)
, AllMimeRender(..)
, AllMimeUnrender(..)
, FromFormUrlEncoded(..)
, ToFormUrlEncoded(..)
, IsNonEmpty