miso-1.0.0.0: A tasty Haskell front-end framework

Copyright(C) 2016-2018 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <djohnson.m@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Router

Description

 
Synopsis

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.

Minimal complete definition

mkRouter

Instances
HasRouter Raw Source #

Raw

Instance details

Defined in Miso.Router

Associated Types

type RouteT Raw a :: Type Source #

Methods

mkRouter :: Proxy Raw -> Proxy a -> RouteT Raw a -> Router a

HasRouter (View a :: Type) Source #

View

Instance details

Defined in Miso.Router

Associated Types

type RouteT (View a) a :: Type Source #

Methods

mkRouter :: Proxy (View a) -> Proxy a0 -> RouteT (View a) a0 -> Router a0

(HasRouter x, HasRouter y) => HasRouter (x :<|> y :: Type) Source #

Alternative

Instance details

Defined in Miso.Router

Associated Types

type RouteT (x :<|> y) a :: Type Source #

Methods

mkRouter :: Proxy (x :<|> y) -> Proxy a -> RouteT (x :<|> y) a -> Router a

(HasRouter sublayout, FromHttpApiData x, KnownSymbol sym) => HasRouter (QueryParam sym x :> sublayout :: Type) Source #

QueryParam

Instance details

Defined in Miso.Router

Associated Types

type RouteT (QueryParam sym x :> sublayout) a :: Type Source #

Methods

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 :: Type) Source #

QueryParams

Instance details

Defined in Miso.Router

Associated Types

type RouteT (QueryParams sym x :> sublayout) a :: Type Source #

Methods

mkRouter :: Proxy (QueryParams sym x :> sublayout) -> Proxy a -> RouteT (QueryParams sym x :> sublayout) a -> Router a

(HasRouter sublayout, KnownSymbol sym) => HasRouter (QueryFlag sym :> sublayout :: Type) Source #

QueryFlag

Instance details

Defined in Miso.Router

Associated Types

type RouteT (QueryFlag sym :> sublayout) a :: Type Source #

Methods

mkRouter :: Proxy (QueryFlag sym :> sublayout) -> Proxy a -> RouteT (QueryFlag sym :> sublayout) a -> Router a

HasRouter sublayout => HasRouter (Header sym x :> sublayout :: Type) Source #

Header

Instance details

Defined in Miso.Router

Associated Types

type RouteT (Header sym x :> sublayout) a :: Type Source #

Methods

mkRouter :: Proxy (Header sym x :> sublayout) -> Proxy a -> RouteT (Header sym x :> sublayout) a -> Router a

(HasRouter sublayout, FromHttpApiData x) => HasRouter (Capture sym x :> sublayout :: Type) Source #

Capture

Instance details

Defined in Miso.Router

Associated Types

type RouteT (Capture sym x :> sublayout) a :: Type Source #

Methods

mkRouter :: Proxy (Capture sym x :> sublayout) -> Proxy a -> RouteT (Capture sym x :> sublayout) a -> Router a

(HasRouter sublayout, KnownSymbol path) => HasRouter (path :> sublayout :: Type) Source #

Path

Instance details

Defined in Miso.Router

Associated Types

type RouteT (path :> sublayout) a :: Type Source #

Methods

mkRouter :: Proxy (path :> sublayout) -> Proxy a -> RouteT (path :> sublayout) a -> Router a

HasRouter (Verb m s c a :: Type) Source #

Verb

Instance details

Defined in Miso.Router

Associated Types

type RouteT (Verb m s c a) a :: Type Source #

Methods

mkRouter :: Proxy (Verb m s c a) -> Proxy a0 -> RouteT (Verb m s c a) a0 -> Router a0

type family RouteT layout a :: * Source #

A mkRouter handler.

Instances
type RouteT Raw x Source # 
Instance details

Defined in Miso.Router

type RouteT Raw x = x
type RouteT (View a :: Type) x Source # 
Instance details

Defined in Miso.Router

type RouteT (View a :: Type) x = x
type RouteT (x :<|> y :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (x :<|> y :: Type) a = RouteT x a :<|> RouteT y a
type RouteT (QueryParam sym x :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (QueryParam sym x :> sublayout :: Type) a = Maybe x -> RouteT sublayout a
type RouteT (QueryParams sym x :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (QueryParams sym x :> sublayout :: Type) a = [x] -> RouteT sublayout a
type RouteT (QueryFlag sym :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (QueryFlag sym :> sublayout :: Type) a = Bool -> RouteT sublayout a
type RouteT (Header sym x :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (Header sym x :> sublayout :: Type) a = Maybe x -> RouteT sublayout a
type RouteT (Capture sym x :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (Capture sym x :> sublayout :: Type) a = x -> RouteT sublayout a
type RouteT (path :> sublayout :: Type) a Source # 
Instance details

Defined in Miso.Router

type RouteT (path :> sublayout :: Type) a = RouteT sublayout a
type RouteT (Verb m s c a :: Type) x Source # 
Instance details

Defined in Miso.Router

type RouteT (Verb m s c a :: Type) x = x

data RoutingError Source #

When routing, the router may fail to match a location.

Constructors

Fail