Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Documentation
Derive this class to use a sum type as a route. Constructors and Selectors map intuitively to url patterns
data AppRoute = HomePage | Users | User Int deriving (Generic, Route) / -> HomePage /users/ -> Users /user/100 -> User 100
Nothing
The default route to use if attempting to match on empty segments
routePath :: a -> [Segment] Source #
Map a route to segments
matchRoute :: [Segment] -> Maybe a Source #
Try to match segments to a route
findRoute :: Route a => [Segment] -> Maybe a Source #
Try to match a route, use defRoute
if it's empty
class GenRoute f where Source #
Automatically derive Route
Instances
GenRoute (U1 :: k -> Type) Source # | |
(GenRoute a, GenRoute b) => GenRoute (a :*: b :: k -> Type) Source # | |
(GenRoute a, GenRoute b) => GenRoute (a :+: b :: k -> Type) Source # | |
Route sub => GenRoute (K1 R sub :: k -> Type) Source # | |
(Constructor c, GenRoute f) => GenRoute (M1 C c f :: k -> Type) Source # | |
GenRoute f => GenRoute (M1 D c f :: k -> Type) Source # | |
GenRoute f => GenRoute (M1 S c f :: k -> Type) Source # | |