xesite/frontend/src/Routes.purs

24 lines
543 B
Plaintext
Raw Normal View History

2016-12-14 07:11:20 +00:00
module App.Routes where
import Control.Alt ((<|>))
import Control.Apply ((<*), (*>))
import Data.Functor ((<$))
import Data.Maybe (fromMaybe)
import Prelude (($), (<$>))
import Pux.Router (param, router, lit, str, end)
data Route = Home
| Resume
| StaticPage String
| BlogIndex
| BlogPost String
| NotFound
match :: String -> Route
match url = fromMaybe NotFound $ router url $
Home <$ end
<|>
BlogIndex <$ lit "blog" <* end
2016-12-14 19:54:17 +00:00
<|>
BlogPost <$> (lit "blog" *> str) <* end