2{-# LANGUAGE DataKinds #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE TypeOperators #-}
9import Data.Time.Calendar
18 , registration_date :: Day
19 } deriving (Eq, Show, Generic)
21#if !MIN_VERSION_aeson(0,10,0)
22-- orphan ToJSON instance for Day. necessary to derive one for User
23instance ToJSON Day where
24 -- display a day in YYYY-mm-dd format
25 toJSON d = toJSON (showGregorian d)
30type UserAPI = "users" :> Get '[JSON] [User]
31 :<|> "albert" :> Get '[JSON] User
32 :<|> "isaac" :> Get '[JSON] User
35isaac = User "Isaac Newton" 372 "isaac@newton.co.uk" (fromGregorian 1683 3 1)
38albert = User "Albert Einstein" 136 "ae@mc2.org" (fromGregorian 1905 12 1)
41users = [isaac, albert]
43userAPI :: Proxy UserAPI
46server :: Server UserAPI
52app = serve userAPI server
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