add 'canonicalize' to canonicalize the api type under a Proxy
This commit is contained in:
parent
73914586b1
commit
6af9b9e70f
1 changed files with 5 additions and 0 deletions
|
@ -48,12 +48,14 @@ module Servant.API (
|
||||||
|
|
||||||
-- * Canonicalizing (flattening) API types
|
-- * Canonicalizing (flattening) API types
|
||||||
Canonicalize,
|
Canonicalize,
|
||||||
|
canonicalize,
|
||||||
|
|
||||||
-- * Utilities
|
-- * Utilities
|
||||||
module Servant.Utils.Links,
|
module Servant.Utils.Links,
|
||||||
-- | Type-safe internal URIs
|
-- | Type-safe internal URIs
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Proxy (Proxy(..))
|
||||||
import Servant.Common.Text (FromText(..), ToText(..))
|
import Servant.Common.Text (FromText(..), ToText(..))
|
||||||
import Servant.API.Alternative ((:<|>) (..))
|
import Servant.API.Alternative ((:<|>) (..))
|
||||||
import Servant.API.Capture (Capture)
|
import Servant.API.Capture (Capture)
|
||||||
|
@ -97,3 +99,6 @@ type family Canonicalize api :: * where
|
||||||
type family Redex a b c :: * where
|
type family Redex a b c :: * where
|
||||||
Redex a a first = Canonicalize first :> a
|
Redex a a first = Canonicalize first :> a
|
||||||
Redex a b first = Canonicalize (first :> b)
|
Redex a b first = Canonicalize (first :> b)
|
||||||
|
|
||||||
|
canonicalize :: Canonicalize layout ~ t => Proxy layout -> Proxy t
|
||||||
|
canonicalize Proxy = Proxy
|
||||||
|
|
Loading…
Reference in a new issue