on master help sign in
add 'canonicalize' to canonicalize the api type under a Proxy
commit6af9b9e70f67f4477919eeb8dbde1eb185814bac authorAlp Mestanogullari <alpmestan@gmail.com> dateMon 9 Mar 2015, 19:23 (12 years ago) parent7391458
1 file changed+5
src/Servant/API.hs+5
src/Servant/API.hs+5
@@ -48,12 +48,14 @@ module Servant.API (
4848
4949 -- * Canonicalizing (flattening) API types
5050 Canonicalize,
51+ canonicalize,
5152
5253 -- * Utilities
5354 module Servant.Utils.Links,
5455 -- | Type-safe internal URIs
5556 ) where
5657
58+import Data.Proxy (Proxy(..))
5759import Servant.Common.Text (FromText(..), ToText(..))
5860import Servant.API.Alternative ((:<|>) (..))
5961import Servant.API.Capture (Capture)
@@ -97,3 +99,6 @@ type family Canonicalize api :: * where
9799type family Redex a b c :: * where
98100 Redex a a first = Canonicalize first :> a
99101 Redex a b first = Canonicalize (first :> b)
102+
103+canonicalize :: Canonicalize layout ~ t => Proxy layout -> Proxy t
104+canonicalize Proxy = Proxy