1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE TypeFamilies #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE TypeOperators #-}
5{-# LANGUAGE FlexibleInstances #-}
6{-# LANGUAGE OverloadedStrings #-}
10import Data.Foldable (foldMap)
15import Servant.HTML.Lucid
21 } deriving Generic -- for the JSON instance
26-- HTML serialization of a single person
27instance ToHtml Person where
30 td_ (toHtml $ firstName p)
31 td_ (toHtml $ lastName p)
32 td_ (toHtml . show $ age p)
36-- HTML serialization of a list of persons
37instance ToHtml [Person] where
38 toHtml persons = table_ $ do
44 foldMap toHtml persons
50 [ Person "Isaac" "Newton" 372
51 , Person "Albert" "Einstein" 136
54type PersonAPI = "persons" :> Get '[JSON, HTML] [Person]
56personAPI :: Proxy PersonAPI
59server :: Server PersonAPI
60server = return persons
63app = serve personAPI 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