simplify the example a bit

This commit is contained in:
Alp Mestanogullari 2014-10-21 17:09:06 +02:00
parent dfc2676c25
commit 1a105448f0

View file

@ -47,6 +47,8 @@ instance (KnownSymbol capture, Captured a, HasServer sublayout)
} }
_ -> return Nothing _ -> return Nothing
-- * Example
type TestApi = "hello" :> Capture "name" Text :> Get Greet type TestApi = "hello" :> Capture "name" Text :> Get Greet
testApi :: Proxy TestApi testApi :: Proxy TestApi
@ -59,8 +61,8 @@ instance ToJSON Greet
server :: Server TestApi server :: Server TestApi
server = server =
(Proxy :: Proxy "hello") Proxy -- :: Proxy "hello"
:> (Proxy :: Proxy (Capture "name" Text)) :> Proxy -- :: Proxy (Capture "name" Text)
:> (return . func) :> (return . func)
where func name = Greet ("Hello, " <> name) where func name = Greet ("Hello, " <> name)