1 {-# LANGUAGE DeriveGeneric #-}
2 {-# LANGUAGE PartialTypeSignatures #-}
3 {-# LANGUAGE NoMonomorphismRestriction #-}
4 {-# OPTIONS_GHC -Wno-missing-signatures #-}
6 module Examples.Ex02 where
8 import Literate.Web hiding (index)
11 -- | A convenient data-type to avoid using Eithers-of-Tuples or Tuples-of-Functions.
15 deriving (Eq, Show, Generic)
17 -- | Using Generic, 'dataType' derives
18 -- from the 'Route' algebraic data-type
19 -- a function transforming Eithers-of-Tuples into a 'Route'.
22 $ pathSegment "index" -- <.> response @Char @'[PlainText]
26 -- <. response2 @Char @'[PlainText]
30 Index{} -> return "INDEX"
31 About -> return "ABOUT"
33 -- c0 = compile CompilerEnv{} router content
35 address_IndexMe :: Address
36 address_IndexMe = address router Index
38 address_AboutMe :: Address
39 address_AboutMe = address router About