1 {-# LANGUAGE DeriveGeneric #-}
2 {-# LANGUAGE NoMonomorphismRestriction #-}
3 {-# OPTIONS_GHC -Wno-missing-signatures #-}
5 module Examples.Ex01 where
7 import Network.URI.Slug as URI
9 import Symantic.Classes (ProductFunctor (..), SumFunctor (..), adt)
13 -- | A convenient data-type to avoid using 'Either's and Tuples.
18 deriving (Eq, Show, Generic)
20 {- | Polymorphic expression describing the website,
21 to be instantiated to the various interpreters.
22 NoMonomorphismRestriction is used to avoid specifying manually
23 the inferred symantic classes.
26 -- site :: IsoFunctor repr => SumFunctor repr => Slugable repr => repr Site
27 -- Using Generic, 'adt' derives (Iso{a2b, b2a} <%>)
28 -- from the 'Site' algebraic data-type.
30 literalSlug "index.html"
31 <+> literalSlug "about.html"
32 <+> captureSlug "user" <. literalSlug "contact.html"