]> Git — Sourcephile - haskell/literate-web.git/blob - tests/Examples/Ex01.hs
feat(compiler): support `ShortText`
[haskell/literate-web.git] / tests / Examples / Ex01.hs
1 {-# LANGUAGE NoMonomorphismRestriction #-}
2 {-# OPTIONS_GHC -Wno-missing-signatures #-}
3
4 module Examples.Ex01 where
5
6 import Control.Monad (Monad (..))
7 import Data.Text (Text)
8 import Literate.Web
9
10 -- | Polymorphic expression describing the website,
11 -- to be instantiated to the various interpreters.
12 -- NoMonomorphismRestriction is used to avoid specifying manually
13 -- the inferred symantic classes.
14 router =
15 pathSegment "index"
16 <.> response @Text @'[PlainText]
17 <+> "about"
18 </> pathSegment "me"
19
20 content =
21 ( compilerEndpoint (return "INDEX")
22 , return "ABOUT"
23 )
24
25 -- c0 = compile CompilerEnv{} router content
26 -- m0 = siteManifest router
27
28 address_Index, address_About :: Address
29 (address_Index :!: address_About) = address router