miso-0.21.1.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

Associated Types

type RouteT layout a :: * Source #

A mkRouter handler.

Instances

HasRouter * Raw Source #

Raw

Associated Types

type RouteT Raw (layout :: Raw) a :: * Source #

Methods

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

HasRouter * (View a) Source #

View

Associated Types

type RouteT (View a) (layout :: View a) a :: * Source #

Methods

mkRouter :: Proxy (View a) layout -> Proxy * a -> RouteT (View a) layout a -> Router a

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

Alternative

Associated Types

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

Methods

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

(HasRouter k sublayout, KnownSymbol path) => HasRouter * ((:>) k Symbol path sublayout) Source #

Path

Associated Types

type RouteT ((:>) k Symbol path sublayout) (layout :: (:>) k Symbol path sublayout) a :: * Source #

Methods

mkRouter :: Proxy ((k :> Symbol) path sublayout) layout -> Proxy * a -> RouteT ((k :> Symbol) path sublayout) layout a -> Router a

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

QueryFlag

Associated Types

type RouteT ((:>) k * (QueryFlag sym) sublayout) (layout :: (:>) k * (QueryFlag sym) sublayout) a :: * Source #

Methods

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

(HasRouter k sublayout, FromHttpApiData x, KnownSymbol sym) => HasRouter * ((:>) k * (QueryParams * sym x) sublayout) Source #

QueryParams

Associated Types

type RouteT ((:>) k * (QueryParams * sym x) sublayout) (layout :: (:>) k * (QueryParams * sym x) sublayout) a :: * Source #

Methods

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

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

QueryParam

Associated Types

type RouteT ((:>) k * (QueryParam * sym x) sublayout) (layout :: (:>) k * (QueryParam * sym x) sublayout) a :: * Source #

Methods

mkRouter :: Proxy ((k :> *) (QueryParam * sym x) sublayout) layout -> Proxy * a -> RouteT ((k :> *) (QueryParam * sym x) sublayout) layout a -> Router a

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

Capture

Associated Types

type RouteT ((:>) k * (Capture * sym x) sublayout) (layout :: (:>) k * (Capture * sym x) sublayout) a :: * Source #

Methods

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

HasRouter * (Verb k k1 m s c a) Source #

Verb

Associated Types

type RouteT (Verb k k1 m s c a) (layout :: Verb k k1 m s c a) a :: * Source #

Methods

mkRouter :: Proxy (Verb k k1 m s c a) layout -> Proxy * a -> RouteT (Verb k k1 m s c a) layout a -> Router a