From 6af9b9e70f67f4477919eeb8dbde1eb185814bac Mon Sep 17 00:00:00 2001 From: Alp Mestanogullari Date: Mon, 9 Mar 2015 19:23:26 +0100 Subject: [PATCH] add 'canonicalize' to canonicalize the api type under a Proxy --- src/Servant/API.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Servant/API.hs b/src/Servant/API.hs index b1448bc7..5bbb0995 100644 --- a/src/Servant/API.hs +++ b/src/Servant/API.hs @@ -48,12 +48,14 @@ module Servant.API ( -- * Canonicalizing (flattening) API types Canonicalize, + canonicalize, -- * Utilities module Servant.Utils.Links, -- | Type-safe internal URIs ) where +import Data.Proxy (Proxy(..)) import Servant.Common.Text (FromText(..), ToText(..)) import Servant.API.Alternative ((:<|>) (..)) import Servant.API.Capture (Capture) @@ -97,3 +99,6 @@ type family Canonicalize api :: * where type family Redex a b c :: * where Redex a a first = Canonicalize first :> a Redex a b first = Canonicalize (first :> b) + +canonicalize :: Canonicalize layout ~ t => Proxy layout -> Proxy t +canonicalize Proxy = Proxy