{-# LANGUAGE AllowAmbiguousTypes #-}
module Data.Effect.Unlift where
import Data.Effect.Tag (type (##))
data UnliftBase b f (a :: Type) where
WithRunInBase :: ((forall x. f x -> b x) -> b a) -> UnliftBase b f a
makeEffectH [''UnliftBase]
type UnliftIO = UnliftBase IO
pattern WithRunInIO :: (f ~> IO -> IO a) -> UnliftIO f a
pattern $bWithRunInIO :: forall (f :: * -> *) a. ((f ~> IO) -> IO a) -> UnliftIO f a
$mWithRunInIO :: forall {r} {f :: * -> *} {a}.
UnliftIO f a -> (((f ~> IO) -> IO a) -> r) -> ((# #) -> r) -> r
WithRunInIO f = WithRunInBase f
{-# COMPLETE WithRunInIO #-}
withRunInIO :: UnliftIO <<: f => (f ~> IO -> IO a) -> f a
withRunInIO :: forall (f :: * -> *) a.
(UnliftIO <<: f) =>
((f ~> IO) -> IO a) -> f a
withRunInIO = forall (b :: * -> *) a (f :: * -> *).
SendSig (UnliftBase b) f =>
((forall x. f x -> b x) -> b a) -> f a
withRunInBase
{-# INLINE withRunInIO #-}
withRunInIO' :: forall tag f a. UnliftIO ## tag <<: f => (f ~> IO -> IO a) -> f a
withRunInIO' :: forall {k} (tag :: k) (f :: * -> *) a.
((UnliftIO ## tag) <<: f) =>
((f ~> IO) -> IO a) -> f a
withRunInIO' = forall {k} (tag :: k) (b :: * -> *) a (f :: * -> *).
SendSig (TagH (UnliftBase b) tag) f =>
((forall x. f x -> b x) -> b a) -> f a
withRunInBase' @tag
{-# INLINE withRunInIO' #-}
withRunInIO'' :: forall key f a. SendSigBy key UnliftIO f => (f ~> IO -> IO a) -> f a
withRunInIO'' :: forall {k} (key :: k) (f :: * -> *) a.
SendSigBy key UnliftIO f =>
((f ~> IO) -> IO a) -> f a
withRunInIO'' = forall {k} (key :: k) (b :: * -> *) a (f :: * -> *).
SendSigBy key (UnliftBase b) f =>
((forall x. f x -> b x) -> b a) -> f a
withRunInBase'' @key
{-# INLINE withRunInIO'' #-}