0 | module TyTTP.Adapter.Node.URI
2 | import Control.Monad.Maybe
3 | import Node.JS.Std.URI
7 | decodeUri : Alternative m
9 | Context me String v h1 s h2 a b
10 | -> m $
Context me' String v' h1' s' h2' a' b'
12 | -> Context me String v h1 s h2 a b
13 | -> m $
Context me' String v' h1' s' h2' a' b'
14 | decodeUri handler ctx = case Std.URI.decodeURI ctx.request.url of
15 | Right str => handler $
{ request.url := str } ctx
19 | decodeUri' : Monad m
21 | Context me String v h1 s h2 a b
22 | -> m $
Context me' String v' h1' s' h2' a' b'
25 | Context me String v h1 s h2 a b
26 | -> MaybeT m $
Context me' String v' h1' s' h2' a' b'
28 | -> Context me String v h1 s h2 a b
29 | -> m $
Context me' String v' h1' s' h2' a' b'
30 | decodeUri' defHandler handler ctx = do
31 | Just result <- runMaybeT $
decodeUri handler ctx
32 | | Nothing => defHandler ctx