@@ -16,20 +16,18 @@ data HTTP (m :: * -> *) k where
1616 Post :: String -> HTTP m String
1717 HGet :: HTTP m String
1818
19−open' :: String -> HttpM ()
19+open' :: Has HTTP sig m => String -> m ()
2020open' s = send (Open s)
2121
22−close' :: HttpM ()
22+close' :: Has HTTP sig m => m ()
2323close' = send Close
2424
25−post' :: String -> HttpM String
25+post' :: Has HTTP sig m => String -> m String
2626post' s = send (Post s)
2727
28−get' :: HttpM String
28+get' :: Has HTTP sig m => m String
2929get' = send HGet
3030
31−type HttpM = HttpC (LiftC IO)
32−
3331instance (Algebra sig m) => Algebra (HTTP :+: sig) (HttpC m) where
3432 alg hdl (L act) ctx = case act of
3533 Open _ -> pure ctx
@@ -38,10 +36,10 @@ instance (Algebra sig m) => Algebra (HTTP :+: sig) (HttpC m) where
3836 HGet -> pure $ ctx $> "lmao"
3937 alg hdl (R other) ctx = HttpC (alg (runHttpC . hdl) other ctx)
4038
41−runHttp :: HttpM a -> IO a
39+runHttp :: HttpC (LiftC IO) a -> IO a
4240runHttp = runM . runHttpC
4341
44−doHTTP :: Int -> HttpC (LiftC IO) Int
42+doHTTP :: Has HTTP sig m => Int -> m Int
4543doHTTP n = do
4644 open' "cats"
4745 replicateM_ n (get' *> post' "cats")