1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE DerivingStrategies #-}
5{-# LANGUAGE OverloadedStrings #-}
6{-# LANGUAGE TypeOperators #-}
12import Data.Typeable (Typeable)
13import GHC.Generics (Generic)
16data Foo = Foo Int String
17 deriving (Generic, Eq, Show, Typeable)
25data SomeSum = A Int | B String
26 deriving (Generic, Eq, Show, Typeable)
28instance Hashable SomeSum
30instance ToJSON SomeSum
32instance FromJSON SomeSum
35 "item" :> ReqBody '[JSON] Int :> Post '[JSON] ()
36 :<|> "getFoo" :> Get '[JSON] Foo
38eliminate :: Int -> Handler ()
39eliminate _ = throwError $ err500 {errBody = "eliminate blew up, oh no!"}
41productServer :: Server ProductApi
42productServer = eliminate :<|> pure (Foo 12 "abc")
45 "item" :> ReqBody '[JSON] Int :> Post '[JSON] ()
46 :<|> "getFoo1" :> Get '[JSON] SomeSum
47 :<|> "getFoo2" :> Get '[JSON] SomeSum
49sumServer :: Server SumApi
50sumServer = eliminate :<|> pure (B "hi") :<|> pure (A 3)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list