@@ -1,8 +1,11 @@
11module Page.Routes where
22
33import Prelude hiding ((/))
4+
5+import Data.Either (hush)
46import Data.Generic.Rep (class Generic)
5−import Routing.Duplex (RouteDuplex', root)
7+import Data.Maybe (fromMaybe)
8+import Routing.Duplex (RouteDuplex', parse, root)
69import Routing.Duplex.Generic (noArgs, sum)
710import Routing.Duplex.Generic.Syntax ((/))
811
@@ -20,6 +23,9 @@ routeCodec =
2023 , "Docs": "docs" / noArgs
2124 }
2225
26+parseOrNotFound :: String -> Route
27+parseOrNotFound str = parse routeCodec str # hush # fromMaybe NotFound
28+
2329-- Instances so we can use route in this way
2430derive instance genericRoute ∷ Generic Route _
2531derive instance eqRoute ∷ Eq Route