git.iko.soy/typeable/servant
on master help sign in
simplify the example a bit
1a10544Alp Mestanogullari
src/Servant.hs+4−2
@@ -47,6 +47,8 @@ instance (KnownSymbol capture, Captured a, HasServer sublayout)
47 }
47 }
48 _ -> return Nothing
48 _ -> return Nothing
49
49
50+-- * Example
51+
50type TestApi = "hello" :> Capture "name" Text :> Get Greet
52type TestApi = "hello" :> Capture "name" Text :> Get Greet
51
53
52testApi :: Proxy TestApi
54testApi :: Proxy TestApi
@@ -59,8 +61,8 @@ instance ToJSON Greet
59
61
60server :: Server TestApi
62server :: Server TestApi
61server =
63server =
62− (Proxy :: Proxy "hello")
64+ Proxy -- :: Proxy "hello"
63− :> (Proxy :: Proxy (Capture "name" Text))
65+ :> Proxy -- :: Proxy (Capture "name" Text)
64 :> (return . func)
66 :> (return . func)
65
67
66 where func name = Greet ("Hello, " <> name)
68 where func name = Greet ("Hello, " <> name)