apiary-0.4.2.0: Simple web framework inspired by scotty.

Safe HaskellNone
LanguageHaskell2010

Control.Monad.Apiary.Filter.Capture

Synopsis

Documentation

data Equal Source

Constructors

Equal Text 

Instances

CaptureElem Equal 
type Next Equal xs = xs 

data Fetch a Source

Constructors

Fetch 

Instances

Param a => CaptureElem (Fetch a) 
type Next (Fetch a) xs = Snoc xs a 

class CaptureElem a where Source

Associated Types

type Next a xs :: [*] Source

Methods

captureElem :: a -> Text -> SList xs -> Maybe (SList (Next a xs)) Source

Instances

type family CaptureResult bf as :: [*] Source

Instances

type CaptureResult bf ([] *) = bf 
type CaptureResult bf ((:) * a as) = CaptureResult (Next a bf) as 

capture' :: Capture as => SList as -> [Text] -> SList xs -> Maybe (SList (CaptureResult xs as)) Source

capture :: (Capture as, Monad m) => SList as -> ApiaryT (CaptureResult xs as) m b -> ApiaryT xs m b Source

low level (without Template Haskell) capture. since 0.4.2.0

myCapture :: SList '[Equal, Fetch Int, Fetch String]
myCapture = Equal "path" ::: (Fetch :: Fetch Int) ::: (Fetch :: Fetch String) ::: SNil

capture myCapture . stdMethod GET . action $ age name -> do
    yourAction