@@ -3,10 +3,10 @@
4module Fused.HTTP where
4module Fused.HTTP where
6−import Control.Effect
6+import Control.Algebra
7−import Control.Effect.Carrier
8import Control.Monad.IO.Class
7import Control.Monad.IO.Class
9import GHC.Generics (Generic1)
8import GHC.Generics (Generic1)
9+import Control.Carrier.Lift
11newtype HttpC m a = HttpC { runHttpC :: m a }
11newtype HttpC m a = HttpC { runHttpC :: m a }
12 deriving newtype (Applicative, Functor, Monad, MonadIO)
12 deriving newtype (Applicative, Functor, Monad, MonadIO)
@@ -33,13 +33,13 @@ get' = send (HGet pure)
34type HttpM = HttpC (LiftC IO)
34type HttpM = HttpC (LiftC IO)
36−instance (Effect sig, Carrier sig m) => Carrier (HTTP :+: sig) (HttpC m) where
36+instance (Effect sig, Algebra sig m) => Algebra (HTTP :+: sig) (HttpC m) where
37− eff (L act) = case act of
37+ alg (L act) = case act of
38 Open _ k -> k
38 Open _ k -> k
39 Close k -> k
39 Close k -> k
40 Post s k -> k ("posted " <> s)
40 Post s k -> k ("posted " <> s)
41 HGet k -> k "lmao"
41 HGet k -> k "lmao"
42− eff (R other) = HttpC (eff (handleCoercible other))
42+ alg (R other) = HttpC (alg (handleCoercible other))
44runHttp :: HttpM a -> IO a
44runHttp :: HttpM a -> IO a
45runHttp = runM . runHttpC
45runHttp = runM . runHttpC