0 | module TyTTP.Core.Routing
2 | import public Control.Monad.Maybe
3 | import TyTTP.Core.Context
6 | routes : Alternative m
8 | Context me u v h1 s h2 a b
9 | -> m $
Context me' p' v' h1' s' h2' a' b'
11 | -> Context me u v h1 s h2 a b
12 | -> m $
Context me' p' v' h1' s' h2' a' b'
13 | routes handlers ctx = choiceMap ($
ctx) handlers
18 | Context me u v h1 s h2 a b
19 | -> m $
Context me' p' v' h1' s' h2' a' b'
22 | Context me u v h1 s h2 a b
23 | -> MaybeT m $
Context me' p' v' h1' s' h2' a' b'
25 | -> Context me u v h1 s h2 a b
26 | -> m $
Context me' p' v' h1' s' h2' a' b'
27 | routes' def handlers ctx = do
28 | Just result <- runMaybeT $
routes handlers ctx
29 | | Nothing => def ctx