{-# LANGUAGE DefaultSignatures, EmptyCase, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, RankNTypes, TypeOperators #-}
module Control.Effect.Class
( HFunctor(..)
, handleCoercible
, Effect(..)
, GHFunctor(..)
, GEffect(..)
) where
import Data.Coerce
import GHC.Generics
class HFunctor h where
hmap :: Functor m => (forall x . m x -> n x) -> (h m a -> h n a)
default hmap :: (Functor m, Generic1 (h m), Generic1 (h n), GHFunctor m n (Rep1 (h m)) (Rep1 (h n))) => (forall x . m x -> n x) -> (h m a -> h n a)
hmap f :: forall x. m x -> n x
f = Rep1 (h n) a -> h n a
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (Rep1 (h n) a -> h n a)
-> (h m a -> Rep1 (h n) a) -> h m a -> h n a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall x. m x -> n x) -> Rep1 (h m) a -> Rep1 (h n) a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> n x
f (Rep1 (h m) a -> Rep1 (h n) a)
-> (h m a -> Rep1 (h m) a) -> h m a -> Rep1 (h n) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. h m a -> Rep1 (h m) a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1
{-# INLINE hmap #-}
handleCoercible :: (HFunctor sig, Functor f, Coercible f g) => sig f a -> sig g a
handleCoercible :: sig f a -> sig g a
handleCoercible = (forall x. f x -> g x) -> sig f a -> sig g a
forall (h :: (* -> *) -> * -> *) (m :: * -> *) (n :: * -> *) a.
(HFunctor h, Functor m) =>
(forall x. m x -> n x) -> h m a -> h n a
hmap forall x. f x -> g x
forall a b. Coercible a b => a -> b
coerce
{-# INLINE handleCoercible #-}
class HFunctor sig => Effect sig where
thread
:: (Functor ctx, Monad m)
=> ctx ()
-> (forall x . ctx (m x) -> n (ctx x))
-> sig m a
-> sig n (ctx a)
default thread
:: (Functor ctx, Monad m, Generic1 (sig m), Generic1 (sig n), GEffect m n (Rep1 (sig m)) (Rep1 (sig n)))
=> ctx ()
-> (forall x . ctx (m x) -> n (ctx x))
-> sig m a
-> sig n (ctx a)
thread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> n (ctx x)
handler = Rep1 (sig n) (ctx a) -> sig n (ctx a)
forall k (f :: k -> *) (a :: k). Generic1 f => Rep1 f a -> f a
to1 (Rep1 (sig n) (ctx a) -> sig n (ctx a))
-> (sig m a -> Rep1 (sig n) (ctx a)) -> sig m a -> sig n (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ctx ()
-> (forall x. ctx (m x) -> n (ctx x))
-> Rep1 (sig m) a
-> Rep1 (sig n) (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> n (ctx x)
handler (Rep1 (sig m) a -> Rep1 (sig n) (ctx a))
-> (sig m a -> Rep1 (sig m) a) -> sig m a -> Rep1 (sig n) (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. sig m a -> Rep1 (sig m) a
forall k (f :: k -> *) (a :: k). Generic1 f => f a -> Rep1 f a
from1
{-# INLINE thread #-}
class GHFunctor m m' rep rep' where
ghmap :: Functor m => (forall x . m x -> m' x) -> (rep a -> rep' a)
instance GHFunctor m m' rep rep' => GHFunctor m m' (M1 i c rep) (M1 i c rep') where
ghmap :: (forall x. m x -> m' x) -> M1 i c rep a -> M1 i c rep' a
ghmap f :: forall x. m x -> m' x
f = rep' a -> M1 i c rep' a
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (rep' a -> M1 i c rep' a)
-> (M1 i c rep a -> rep' a) -> M1 i c rep a -> M1 i c rep' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall x. m x -> m' x) -> rep a -> rep' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f (rep a -> rep' a)
-> (M1 i c rep a -> rep a) -> M1 i c rep a -> rep' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. M1 i c rep a -> rep a
forall i (c :: Meta) k (f :: k -> *) (p :: k). M1 i c f p -> f p
unM1
{-# INLINE ghmap #-}
instance (GHFunctor m m' l l', GHFunctor m m' r r') => GHFunctor m m' (l :+: r) (l' :+: r') where
ghmap :: (forall x. m x -> m' x) -> (:+:) l r a -> (:+:) l' r' a
ghmap f :: forall x. m x -> m' x
f (L1 l :: l a
l) = l' a -> (:+:) l' r' a
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 ((forall x. m x -> m' x) -> l a -> l' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f l a
l)
ghmap f :: forall x. m x -> m' x
f (R1 r :: r a
r) = r' a -> (:+:) l' r' a
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 ((forall x. m x -> m' x) -> r a -> r' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f r a
r)
{-# INLINE ghmap #-}
instance (GHFunctor m m' l l', GHFunctor m m' r r') => GHFunctor m m' (l :*: r) (l' :*: r') where
ghmap :: (forall x. m x -> m' x) -> (:*:) l r a -> (:*:) l' r' a
ghmap f :: forall x. m x -> m' x
f (l :: l a
l :*: r :: r a
r) = (forall x. m x -> m' x) -> l a -> l' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f l a
l l' a -> r' a -> (:*:) l' r' a
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: (forall x. m x -> m' x) -> r a -> r' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f r a
r
{-# INLINE ghmap #-}
instance GHFunctor m m' V1 V1 where
ghmap :: (forall x. m x -> m' x) -> V1 a -> V1 a
ghmap _ v :: V1 a
v = case V1 a
v of {}
{-# INLINE ghmap #-}
instance GHFunctor m m' U1 U1 where
ghmap :: (forall x. m x -> m' x) -> U1 a -> U1 a
ghmap _ = U1 a -> U1 a
forall a. a -> a
id
{-# INLINE ghmap #-}
instance GHFunctor m m' (K1 R c) (K1 R c) where
ghmap :: (forall x. m x -> m' x) -> K1 R c a -> K1 R c a
ghmap _ = K1 R c a -> K1 R c a
forall a b. Coercible a b => a -> b
coerce
{-# INLINE ghmap #-}
instance GHFunctor m m' Par1 Par1 where
ghmap :: (forall x. m x -> m' x) -> Par1 a -> Par1 a
ghmap _ = Par1 a -> Par1 a
forall a b. Coercible a b => a -> b
coerce
{-# INLINE ghmap #-}
instance (Functor f, GHFunctor m m' g g') => GHFunctor m m' (f :.: g) (f :.: g') where
ghmap :: (forall x. m x -> m' x) -> (:.:) f g a -> (:.:) f g' a
ghmap f :: forall x. m x -> m' x
f = f (g' a) -> (:.:) f g' a
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (f (g' a) -> (:.:) f g' a)
-> ((:.:) f g a -> f (g' a)) -> (:.:) f g a -> (:.:) f g' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g a -> g' a) -> f (g a) -> f (g' a)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((forall x. m x -> m' x) -> g a -> g' a
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) a.
(GHFunctor m m' rep rep', Functor m) =>
(forall x. m x -> m' x) -> rep a -> rep' a
ghmap forall x. m x -> m' x
f) (f (g a) -> f (g' a))
-> ((:.:) f g a -> f (g a)) -> (:.:) f g a -> f (g' a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) f g a -> f (g a)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
(:.:) f g p -> f (g p)
unComp1
{-# INLINE ghmap #-}
instance GHFunctor m m' (Rec1 m) (Rec1 m') where
ghmap :: (forall x. m x -> m' x) -> Rec1 m a -> Rec1 m' a
ghmap f :: forall x. m x -> m' x
f = m' a -> Rec1 m' a
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (m' a -> Rec1 m' a) -> (Rec1 m a -> m' a) -> Rec1 m a -> Rec1 m' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. m a -> m' a
forall x. m x -> m' x
f (m a -> m' a) -> (Rec1 m a -> m a) -> Rec1 m a -> m' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rec1 m a -> m a
forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1
{-# INLINE ghmap #-}
instance HFunctor f => GHFunctor m m' (Rec1 (f m)) (Rec1 (f m')) where
ghmap :: (forall x. m x -> m' x) -> Rec1 (f m) a -> Rec1 (f m') a
ghmap f :: forall x. m x -> m' x
f = f m' a -> Rec1 (f m') a
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (f m' a -> Rec1 (f m') a)
-> (Rec1 (f m) a -> f m' a) -> Rec1 (f m) a -> Rec1 (f m') a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall x. m x -> m' x) -> f m a -> f m' a
forall (h :: (* -> *) -> * -> *) (m :: * -> *) (n :: * -> *) a.
(HFunctor h, Functor m) =>
(forall x. m x -> n x) -> h m a -> h n a
hmap forall x. m x -> m' x
f (f m a -> f m' a)
-> (Rec1 (f m) a -> f m a) -> Rec1 (f m) a -> f m' a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rec1 (f m) a -> f m a
forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1
{-# INLINE ghmap #-}
class GEffect m m' rep rep' where
gthread
:: (Functor ctx, Monad m)
=> ctx ()
-> (forall x . ctx (m x) -> m' (ctx x))
-> rep a
-> rep' (ctx a)
instance GEffect m m' rep rep' => GEffect m m' (M1 i c rep) (M1 i c rep') where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> M1 i c rep a
-> M1 i c rep' (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler = rep' (ctx a) -> M1 i c rep' (ctx a)
forall k i (c :: Meta) (f :: k -> *) (p :: k). f p -> M1 i c f p
M1 (rep' (ctx a) -> M1 i c rep' (ctx a))
-> (M1 i c rep a -> rep' (ctx a))
-> M1 i c rep a
-> M1 i c rep' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler (rep a -> rep' (ctx a))
-> (M1 i c rep a -> rep a) -> M1 i c rep a -> rep' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. M1 i c rep a -> rep a
forall i (c :: Meta) k (f :: k -> *) (p :: k). M1 i c f p -> f p
unM1
{-# INLINE gthread #-}
instance (GEffect m m' l l', GEffect m m' r r') => GEffect m m' (l :+: r) (l' :+: r') where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> (:+:) l r a
-> (:+:) l' r' (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler (L1 l :: l a
l) = l' (ctx a) -> (:+:) l' r' (ctx a)
forall k (f :: k -> *) (g :: k -> *) (p :: k). f p -> (:+:) f g p
L1 (ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> l a -> l' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler l a
l)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler (R1 r :: r a
r) = r' (ctx a) -> (:+:) l' r' (ctx a)
forall k (f :: k -> *) (g :: k -> *) (p :: k). g p -> (:+:) f g p
R1 (ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> r a -> r' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler r a
r)
{-# INLINE gthread #-}
instance (GEffect m m' l l', GEffect m m' r r') => GEffect m m' (l :*: r) (l' :*: r') where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> (:*:) l r a
-> (:*:) l' r' (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler (l :: l a
l :*: r :: r a
r) = ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> l a -> l' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler l a
l l' (ctx a) -> r' (ctx a) -> (:*:) l' r' (ctx a)
forall k (f :: k -> *) (g :: k -> *) (p :: k).
f p -> g p -> (:*:) f g p
:*: ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> r a -> r' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler r a
r
{-# INLINE gthread #-}
instance GEffect m m' V1 V1 where
gthread :: ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> V1 a -> V1 (ctx a)
gthread _ _ v :: V1 a
v = case V1 a
v of {}
{-# INLINE gthread #-}
instance GEffect m m' U1 U1 where
gthread :: ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> U1 a -> U1 (ctx a)
gthread _ _ = U1 a -> U1 (ctx a)
forall a b. Coercible a b => a -> b
coerce
{-# INLINE gthread #-}
instance GEffect m m' (K1 R c) (K1 R c) where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> K1 R c a
-> K1 R c (ctx a)
gthread _ _ = K1 R c a -> K1 R c (ctx a)
forall a b. Coercible a b => a -> b
coerce
{-# INLINE gthread #-}
instance GEffect m m' Par1 Par1 where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> Par1 a -> Par1 (ctx a)
gthread ctx :: ctx ()
ctx _ = ctx a -> Par1 (ctx a)
forall p. p -> Par1 p
Par1 (ctx a -> Par1 (ctx a))
-> (Par1 a -> ctx a) -> Par1 a -> Par1 (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> ctx () -> ctx a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ctx ()
ctx) (a -> ctx a) -> (Par1 a -> a) -> Par1 a -> ctx a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Par1 a -> a
forall p. Par1 p -> p
unPar1
{-# INLINE gthread #-}
instance (Functor f, GEffect m m' g g') => GEffect m m' (f :.: g) (f :.: g') where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> (:.:) f g a
-> (:.:) f g' (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler = f (g' (ctx a)) -> (:.:) f g' (ctx a)
forall k2 k1 (f :: k2 -> *) (g :: k1 -> k2) (p :: k1).
f (g p) -> (:.:) f g p
Comp1 (f (g' (ctx a)) -> (:.:) f g' (ctx a))
-> ((:.:) f g a -> f (g' (ctx a)))
-> (:.:) f g a
-> (:.:) f g' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (g a -> g' (ctx a)) -> f (g a) -> f (g' (ctx a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ctx () -> (forall x. ctx (m x) -> m' (ctx x)) -> g a -> g' (ctx a)
forall (m :: * -> *) (m' :: * -> *) (rep :: * -> *)
(rep' :: * -> *) (ctx :: * -> *) a.
(GEffect m m' rep rep', Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> rep a -> rep' (ctx a)
gthread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler) (f (g a) -> f (g' (ctx a)))
-> ((:.:) f g a -> f (g a)) -> (:.:) f g a -> f (g' (ctx a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (:.:) f g a -> f (g a)
forall k2 (f :: k2 -> *) k1 (g :: k1 -> k2) (p :: k1).
(:.:) f g p -> f (g p)
unComp1
{-# INLINE gthread #-}
instance GEffect m m' (Rec1 m) (Rec1 m') where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> Rec1 m a
-> Rec1 m' (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler = m' (ctx a) -> Rec1 m' (ctx a)
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (m' (ctx a) -> Rec1 m' (ctx a))
-> (Rec1 m a -> m' (ctx a)) -> Rec1 m a -> Rec1 m' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ctx (m a) -> m' (ctx a)
forall x. ctx (m x) -> m' (ctx x)
handler (ctx (m a) -> m' (ctx a))
-> (Rec1 m a -> ctx (m a)) -> Rec1 m a -> m' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (m a -> ctx () -> ctx (m a)
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ ctx ()
ctx) (m a -> ctx (m a)) -> (Rec1 m a -> m a) -> Rec1 m a -> ctx (m a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rec1 m a -> m a
forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1
{-# INLINE gthread #-}
instance Effect sig => GEffect m m' (Rec1 (sig m)) (Rec1 (sig m')) where
gthread :: ctx ()
-> (forall x. ctx (m x) -> m' (ctx x))
-> Rec1 (sig m) a
-> Rec1 (sig m') (ctx a)
gthread ctx :: ctx ()
ctx handler :: forall x. ctx (m x) -> m' (ctx x)
handler = sig m' (ctx a) -> Rec1 (sig m') (ctx a)
forall k (f :: k -> *) (p :: k). f p -> Rec1 f p
Rec1 (sig m' (ctx a) -> Rec1 (sig m') (ctx a))
-> (Rec1 (sig m) a -> sig m' (ctx a))
-> Rec1 (sig m) a
-> Rec1 (sig m') (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ctx ()
-> (forall x. ctx (m x) -> m' (ctx x)) -> sig m a -> sig m' (ctx a)
forall (sig :: (* -> *) -> * -> *) (ctx :: * -> *) (m :: * -> *)
(n :: * -> *) a.
(Effect sig, Functor ctx, Monad m) =>
ctx ()
-> (forall x. ctx (m x) -> n (ctx x)) -> sig m a -> sig n (ctx a)
thread ctx ()
ctx forall x. ctx (m x) -> m' (ctx x)
handler (sig m a -> sig m' (ctx a))
-> (Rec1 (sig m) a -> sig m a) -> Rec1 (sig m) a -> sig m' (ctx a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Rec1 (sig m) a -> sig m a
forall k (f :: k -> *) (p :: k). Rec1 f p -> f p
unRec1
{-# INLINE gthread #-}