Copyright | (C) 2016-2018 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <djohnson.m@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Documentation
runRoute :: HasRouter layout => Proxy layout -> RouteT layout (m -> a) -> (m -> URI) -> m -> Either RoutingError a Source #
route :: HasRouter layout => Proxy layout -> RouteT layout a -> URI -> Either RoutingError a Source #
Use a handler to mkRouter a location, represented as a String
.
All handlers must, in the end, return m a
.
routeLoc
will choose a mkRouter and return its result.
class HasRouter layout Source #
This is similar to the HasServer
class from servant-server
.
It is the class responsible for making API combinators routable.
RouteT
is used to build up the handler types.
Router
is returned, to be interpretted by routeLoc
.
mkRouter
Instances
HasRouter Raw Source # | Raw |
HasRouter (View a :: *) Source # | View |
(HasRouter x, HasRouter y) => HasRouter (x :<|> y :: *) Source # | Alternative |
(HasRouter sublayout, FromHttpApiData x, KnownSymbol sym) => HasRouter (QueryParam sym x :> sublayout :: *) Source # | QueryParam |
Defined in Miso.Router mkRouter :: Proxy (QueryParam sym x :> sublayout) -> Proxy a -> RouteT (QueryParam sym x :> sublayout) a -> Router a | |
(HasRouter sublayout, FromHttpApiData x, KnownSymbol sym) => HasRouter (QueryParams sym x :> sublayout :: *) Source # | QueryParams |
Defined in Miso.Router mkRouter :: Proxy (QueryParams sym x :> sublayout) -> Proxy a -> RouteT (QueryParams sym x :> sublayout) a -> Router a | |
(HasRouter sublayout, KnownSymbol sym) => HasRouter (QueryFlag sym :> sublayout :: *) Source # | QueryFlag |
(HasRouter sublayout, FromHttpApiData x) => HasRouter (Capture sym x :> sublayout :: *) Source # | Capture |
(HasRouter sublayout, KnownSymbol path) => HasRouter (path :> sublayout :: *) Source # | Path |
HasRouter (Verb m s c a :: *) Source # | Verb |
type family RouteT layout a :: * Source #
A mkRouter handler.
Instances
type RouteT Raw x Source # | |
Defined in Miso.Router | |
type RouteT (View a :: *) x Source # | |
Defined in Miso.Router | |
type RouteT (x :<|> y :: *) a Source # | |
type RouteT (QueryParam sym x :> sublayout :: *) a Source # | |
Defined in Miso.Router | |
type RouteT (QueryParams sym x :> sublayout :: *) a Source # | |
Defined in Miso.Router | |
type RouteT (QueryFlag sym :> sublayout :: *) a Source # | |
type RouteT (Capture sym x :> sublayout :: *) a Source # | |
type RouteT (path :> sublayout :: *) a Source # | |
Defined in Miso.Router | |
type RouteT (Verb m s c a :: *) x Source # | |
Defined in Miso.Router |
data RoutingError Source #
When routing, the router may fail to match a location.
Instances
Eq RoutingError Source # | |
Defined in Miso.Router (==) :: RoutingError -> RoutingError -> Bool # (/=) :: RoutingError -> RoutingError -> Bool # | |
Ord RoutingError Source # | |
Defined in Miso.Router compare :: RoutingError -> RoutingError -> Ordering # (<) :: RoutingError -> RoutingError -> Bool # (<=) :: RoutingError -> RoutingError -> Bool # (>) :: RoutingError -> RoutingError -> Bool # (>=) :: RoutingError -> RoutingError -> Bool # max :: RoutingError -> RoutingError -> RoutingError # min :: RoutingError -> RoutingError -> RoutingError # | |
Show RoutingError Source # | |
Defined in Miso.Router showsPrec :: Int -> RoutingError -> ShowS # show :: RoutingError -> String # showList :: [RoutingError] -> ShowS # |