on master help sign in
Export interface implementations of Network.Cgi (#4580)
c536a6eHadi Moshayedi
libs/contrib/Network/Cgi.idr+3
@@ -30,10 +30,12 @@ data CGI : Type -> Type where
30getAction : CGI a -> CGIInfo -> IO (a, CGIInfo)
30getAction : CGI a -> CGIInfo -> IO (a, CGIInfo)
31getAction (MkCGI act) = act
31getAction (MkCGI act) = act
32
32
33+export
33implementation Functor CGI where
34implementation Functor CGI where
34 map f (MkCGI c) = MkCGI (\s => do (a, i) <- c s
35 map f (MkCGI c) = MkCGI (\s => do (a, i) <- c s
35 pure (f a, i))
36 pure (f a, i))
36
37
38+export
37implementation Applicative CGI where
39implementation Applicative CGI where
38 pure v = MkCGI (\s => pure (v, s))
40 pure v = MkCGI (\s => pure (v, s))
39
41
@@ -41,6 +43,7 @@ implementation Applicative CGI where
41 (c, j) <- b i
43 (c, j) <- b i
42 pure (f c, j))
44 pure (f c, j))
43
45
46+export
44implementation Monad CGI where
47implementation Monad CGI where
45 (>>=) (MkCGI f) k = MkCGI (\s => do v <- f s
48 (>>=) (MkCGI f) k = MkCGI (\s => do v <- f s
46 getAction (k (fst v)) (snd v))
49 getAction (k (fst v)) (snd v))