-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | The Bluefin effect system, internals
--   
--   The Bluefin effect system, internals
@package bluefin-internal
@version 0.8.0.0

module Bluefin.Internal.Key
data Key (a :: k)
newKey :: IO (Key a)
eqKey :: forall a b. Key a -> Key b -> Maybe (a :~~: b)

module Bluefin.Internal.Exception.Scoped
data Exception (e :: Type)
data InFlight
try :: (Exception e -> IO a) -> IO (Either e a)
throw :: Exception e -> e -> IO a
newException :: IO (Exception e)
checkException :: Exception e -> InFlight -> Maybe e
instance GHC.Show.Show Bluefin.Internal.Exception.Scoped.InFlight
instance GHC.Exception.Type.Exception Bluefin.Internal.Exception.Scoped.InFlight

module Bluefin.Internal.OneWayCoercible
class OneWayCoercible a b
oneWayCoercibleImpl :: OneWayCoercible a b => OneWayCoercibleD a b
newtype OneWayCoercibleD a b
MkOneWayCoercibleD :: OneWayCoercion a b -> OneWayCoercibleD a b
newtype OneWayCoercion a b
MkOneWayCoercion :: Coercion a b -> OneWayCoercion a b
class GOneWayCoercible a b
gOneWayCoercible :: GOneWayCoercible (Rep (h e)) (Rep (h es)) => OneWayCoercibleD (h e) (h es)
oneWayCoerce :: forall a b. OneWayCoercible a b => a -> b
oneWayCoercible :: Coercible a b => OneWayCoercibleD a b
oneWayCoercion :: OneWayCoercible a b => OneWayCoercion a b
unsafeCoercionOfOneWayCoercion :: OneWayCoercion a b -> Coercion a b
unsafeOneWayCoercible :: forall a b. OneWayCoercibleD a b
gOneWayCoercion :: forall a b. GOneWayCoercible (Rep a) (Rep b) => OneWayCoercion a b
trans :: OneWayCoercion a b -> OneWayCoercion b c -> OneWayCoercion a c
unsafeOneWayCoercion :: forall a b. OneWayCoercion a b
gOneWayCoercible2 :: GOneWayCoercible (Rep (h e e')) (Rep (h es es')) => OneWayCoercibleD (h e e') (h es es')
oneWayCoerceWith :: OneWayCoercion a b -> a -> b
unsafeCoercionOfOneWayCoercible :: forall a b. OneWayCoercible a b => Coercion a b
class () => Generic a
instance Bluefin.Internal.OneWayCoercible.GOneWayCoercible GHC.Generics.U1 GHC.Generics.U1
instance Bluefin.Internal.OneWayCoercible.OneWayCoercible c c' => Bluefin.Internal.OneWayCoercible.GOneWayCoercible (GHC.Generics.K1 i c) (GHC.Generics.K1 i' c')
instance forall k1 k2 (f :: k1 -> *) (f' :: k2 -> *) i (t :: GHC.Generics.Meta) i' (t' :: GHC.Generics.Meta). Bluefin.Internal.OneWayCoercible.GOneWayCoercible f f' => Bluefin.Internal.OneWayCoercible.GOneWayCoercible (GHC.Generics.M1 i t f) (GHC.Generics.M1 i' t' f')
instance forall k1 k2 (f :: k1 -> *) (f' :: k2 -> *) (g :: k1 -> *) (g' :: k2 -> *). (Bluefin.Internal.OneWayCoercible.GOneWayCoercible f f', Bluefin.Internal.OneWayCoercible.GOneWayCoercible g g') => Bluefin.Internal.OneWayCoercible.GOneWayCoercible (f GHC.Generics.:*: g) (f' GHC.Generics.:*: g')
instance forall k (s :: k). Bluefin.Internal.OneWayCoercible.OneWayCoercible s s
instance Bluefin.Internal.OneWayCoercible.OneWayCoercible () ()
instance Bluefin.Internal.OneWayCoercible.OneWayCoercible a1 a2 => Bluefin.Internal.OneWayCoercible.OneWayCoercible (GHC.Maybe.Maybe a1) (GHC.Maybe.Maybe a2)
instance (Bluefin.Internal.OneWayCoercible.OneWayCoercible a1 a2, Bluefin.Internal.OneWayCoercible.OneWayCoercible b1 b2) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Data.Either.Either a1 b1) (Data.Either.Either a2 b2)
instance (Bluefin.Internal.OneWayCoercible.OneWayCoercible a1 a2, Bluefin.Internal.OneWayCoercible.OneWayCoercible b1 b2) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (a1, b1) (a2, b2)
instance (Bluefin.Internal.OneWayCoercible.OneWayCoercible a a', Bluefin.Internal.OneWayCoercible.OneWayCoercible b b') => Bluefin.Internal.OneWayCoercible.OneWayCoercible (a' -> b) (a -> b')
instance forall k (h :: k -> *) (e :: k) (es :: k). Bluefin.Internal.OneWayCoercible.OneWayCoercible (h e) (h es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (GHC.Generics.Rec1 h e) (GHC.Generics.Rec1 h es)
instance forall k (h :: k -> *) (e :: k) (es :: k) i (t :: GHC.Generics.Meta). Bluefin.Internal.OneWayCoercible.OneWayCoercible (h e) (h es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (GHC.Generics.M1 i t h e) (GHC.Generics.M1 i t h es)
instance forall k (h1 :: k -> *) (e :: k) (es :: k) (h2 :: k -> *). (Bluefin.Internal.OneWayCoercible.OneWayCoercible (h1 e) (h1 es), Bluefin.Internal.OneWayCoercible.OneWayCoercible (h2 e) (h2 es)) => Bluefin.Internal.OneWayCoercible.OneWayCoercible ((GHC.Generics.:*:) h1 h2 e) ((GHC.Generics.:*:) h1 h2 es)

module Bluefin.Internal.Vault
newtype Key a
MkKey :: Key Any -> Key a
newKey :: IO (Key a)
lookup :: Key a -> Vault -> Maybe a
fromMine :: Key a -> Key a
toMine :: Key a -> Key a
adjust :: (a -> a) -> Key a -> Vault -> Vault
insert :: Key a -> a -> Vault -> Vault
type Vault = Vault RealWorld
empty :: Vault

module Bluefin.Internal

-- | Each inhabitant of <tt>Effects</tt> is a set of effect tags, used for
--   effect tracking to ensure that effects don't escape the scope of their
--   handler
data Effects
Union :: Effects -> Effects -> Effects

-- | <pre>
--   type (:&amp;) :: Effects -&gt; Effects -&gt; Effects
--   </pre>
--   
--   Union of sets of effect tags
type (:&) = Union
infixr 9 :&
type Env = IORef Vault
newtype Eff (es :: Effects) a
UnsafeMkEff :: (Env -> IO a) -> Eff (es :: Effects) a
[unsafeUnEff] :: Eff (es :: Effects) a -> Env -> IO a

-- | Because doing <a>IO</a> operations inside <a>Eff</a> requires a
--   value-level argument we can't give <tt>IO</tt>-related instances to
--   <tt>Eff</tt> directly. Instead we wrap it in <tt>EffReader</tt>.
newtype EffReader r es a
MkEffReader :: (r -> Eff es a) -> EffReader r es a
[unEffReader] :: EffReader r es a -> r -> Eff es a
effReader :: (r -> Eff es a) -> EffReader r es a
runEffReader :: r -> EffReader r es a -> Eff es a

-- | Deprecated. Use <a>withEffToIO_</a> instead.
withEffToIO :: e2 <: es => ((forall r. (forall e1. IOE e1 -> Eff (e1 :& es) r) -> IO r) -> IO a) -> IOE e2 -> Eff es a
withEffToIO' :: e2 <: es => IOE e2 -> ((forall r. (forall e1. IOE e1 -> Eff (e1 :& es) r) -> IO r) -> IO a) -> Eff es a

-- | This is equivalent to the <a>withRunInIO</a> method of
--   <a>MonadUnliftIO</a>, but written in Bluefin-style.
withEffToIO_ :: e <: es => IOE e -> ((forall r. Eff es r -> IO r) -> IO a) -> Eff es a
withEffToIO_' :: e2 <: es => IOE e2 -> ((forall r. (forall e1. IOE e1 -> Eff (e1 :& es) r) -> IO r) -> IO a) -> Eff es a
race :: e2 <: es => (forall e. IOE e -> Eff (e :& es) a) -> (forall e. IOE e -> Eff (e :& es) a) -> IOE e2 -> Eff es a
withClonedEnv :: Eff es r -> Eff es r

-- | Connect two coroutines. Their execution is interleaved by exchanging
--   <tt>a</tt>s and <tt>b</tt>s. When the former yields its first
--   <tt>a</tt> it starts the latter (which is awaiting an <tt>a</tt>).
connectCoroutines :: forall es a b r. (forall e. Coroutine a b e -> Eff (e :& es) r) -> (forall e. a -> Coroutine b a e -> Eff (e :& es) r) -> Eff es r

-- | Old name for <a>consumeStream</a>. <tt>receiveStream</tt> will be
--   deprecated in a future version.
receiveStream :: (forall e. Consume a e -> Eff (e :& es) r) -> (forall e. Stream a e -> Eff (e :& es) r) -> Eff es r
consumeStream :: (forall e. Consume a e -> Eff (e :& es) r) -> (forall e. Stream a e -> Eff (e :& es) r) -> Eff es r

-- | Argument-flipped version of <a>consumeStream</a>
streamConsume :: forall a (es :: Effects) r. (forall (e :: Effects). Stream a e -> Eff (e :& es) r) -> (forall (e :: Effects). Consume a e -> Eff (e :& es) r) -> Eff es r
hoistReader :: (forall b. m b -> n b) -> ReaderT r m a -> ReaderT r n a

-- | Run <a>MonadIO</a> operations in <a>Eff</a>.
--   
--   <pre>
--   &gt;&gt;&gt; runEff $ \io -&gt; withMonadIO io $ liftIO $ do
--         putStrLn "Hello world!"
--   Hello, world!
--   </pre>
withMonadIO :: e <: es => IOE e -> (forall m. MonadIO m => m r) -> Eff es r

-- | Run <a>MonadFail</a> operations in <a>Eff</a>.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ try $ \e -&gt;
--         when (2 &gt; 1) $
--           withMonadFail e (fail "2 was bigger than 1")
--   Left "2 was bigger than 1"
--   </pre>
withMonadFail :: e <: es => Exception String e -> (forall m. MonadFail m => m r) -> Eff es r

-- | Run an <a>Eff</a> that doesn't contain any unhandled effects.
runPureEff :: (forall es. Eff es a) -> a
unsafeCoerceEff :: Eff t r -> Eff t' r
weakenEff :: (t `In` t') -> Eff t r -> Eff t' r
insertFirst :: Eff b r -> Eff (c1 :& b) r
insertSecond :: Eff (c1 :& b) r -> Eff (c1 :& (c2 :& b)) r
insertManySecond :: b <: c => Eff (c1 :& b) r -> Eff (c1 :& c) r
assoc1Eff :: Eff ((a :& b) :& c) r -> Eff (a :& (b :& c)) r
pushFirst :: Eff a r -> Eff (a :& b) r
mergeEff :: Eff (a :& a) r -> Eff a r
inContext :: e2 <: e1 => Eff (e1 :& e2) r -> Eff e1 r

-- | Used to define dynamic effects.
makeOp :: Eff (e :& e) r -> Eff e r

-- | Used to define dynamic effects.
useImpl :: e <: es => Eff e r -> Eff es r

-- | Like <a>useImpl</a>
useImplUnder :: e <: es => Eff (e1 :& e) r -> Eff (e1 :& es) r

-- | Used to define handlers of compound effects.
useImplIn :: e <: es => (t -> Eff (es :& e) r) -> t -> Eff es r

-- | Deprecated. Use <a>useImplUnder</a> instead.
useImplWithin :: e <: es => (t -> Eff (e1 :& e) r) -> t -> Eff (e1 :& es) r

-- | Capability to create strict mutable state capabilities
data StateSource (e :: Effects)
StateSource :: StateSource (e :: Effects)

-- | Capability to throw an exception of type <tt>exn</tt>
newtype Exception exn (e :: Effects)
MkException :: (forall a. exn -> Eff e a) -> Exception exn (e :: Effects)

-- | Capability to modify a reference to an <tt>s</tt>
newtype State s (e :: Effects)
UnsafeMkState :: IORef s -> State s (e :: Effects)

-- | Capability to yield a value of type <tt>a</tt> and then await a value
--   of type <tt>b</tt> in response.
newtype Coroutine a b (e :: Effects)
MkCoroutine :: (a -> Eff e b) -> Coroutine a b (e :: Effects)

-- | Capability to yield values of type <tt>a</tt>. It is implemented as a
--   <a>Request</a> capability that can yield values of type <tt>a</tt> and
--   then await values of type <tt>()</tt>.
type Stream a = Coroutine a ()
type Consume a = Coroutine () a

-- | Every Bluefin capability should have an instance of class
--   <tt>Handle</tt>. Built-in capabilities, such as <a>Exception</a>,
--   <a>State</a> and <a>IOE</a>, come with <tt>Handle</tt> instances.
--   
--   You should define a <tt>Handle</tt> instance for each capability that
--   you define yourself. As an example, an "application" capability with a
--   dynamic effect for database queries, a concrete effect for application
--   state and a concrete effect for a logging effect might look like this:
--   
--   <pre>
--   data Application e = MkApplication
--     { queryDatabase :: String -&gt; Int -&gt; Eff e [String],
--       applicationState :: State (Int, Bool) e,
--       logger :: Stream String e
--     }
--     deriving (Generic)
--     deriving (Handle) via <a>OneWayCoercibleHandle</a> Application
--   
--   instance (e &lt;: es) =&gt; <a>OneWayCoercible</a> (Application e) (Application es) where
--     oneWayCoercibleImpl = <a>gOneWayCoercible</a>
--   </pre>
--   
--   In occasional cases, <tt>gOneWayCoercible</tt> won't work, in which
--   can you can instead use
--   
--   <pre>
--   instance (e &lt;: es) =&gt; OneWayCoercible (MyCapability e) (MyCapability es) where
--     oneWayCoercibleImpl = <a>oneWayCoercibleTrustMe</a> $ \h -&gt; &lt;mapHandle definition&gt;
--   </pre>
--   
--   Please note the "handle" nomeclature is legacy and will probably
--   change to "capability" in the future. See <a>Bluefin.Capability</a>.
class Handle (h :: Effects -> Type)
handleImpl :: Handle h => HandleD h

-- | This was previously a method of class <a>Handle</a> using which you
--   could define <tt>Handle</tt> instances. Now, you should define
--   <tt>handleImpl</tt> instead. If you previously had a definition of
--   <tt>mapHandle</tt>, for example like this:
--   
--   <pre>
--   instance Handle MyCapability where
--     mapHandle h = &lt;mapHandle definition&gt;
--   </pre>
--   
--   you should change it to
--   
--   <pre>
--   data MyCapability e = ...
--     deriving (Generic)
--     deriving (Handle) via <a>OneWayCoercibleHandle</a> MyCapability
--   
--   instance (e &lt;: es) =&gt; <a>OneWayCoercible</a> (MyCapability e) (MyCapability es) where
--     <a>oneWayCoercibleImpl</a> = <a>gOneWayCoercible</a>
--   </pre>
--   
--   In occasional cases, <tt>gOneWayCoercible</tt> won't work, in which
--   can you can instead use
--   
--   <pre>
--   instance (e &lt;: es) =&gt; OneWayCoercible (MyCapability e) (MyCapability es) where
--     oneWayCoercibleImpl = <a>oneWayCoercibleTrustMe</a> $ \h -&gt; &lt;mapHandle definition&gt;
--   </pre>
mapHandle :: forall h e es. (Handle h, e <: es) => h e -> h es
withHandle :: forall h r. Handle h => ((forall e es. e <: es => OneWayCoercible (h e) (h es)) => r) -> r
data HandleDict h
[MkHandleDict] :: (forall e es. e <: es => OneWayCoercible (h e) (h es)) => HandleDict h

-- | The type of the <a>handleImpl</a> method of the <a>Handle</a> class.
--   Create a <tt>HandleD</tt> using deriving via of
--   <a>OneWayCoercibleHandle</a>.
newtype HandleD h
MkHandleD :: HandleDict Any -> HandleD h
handleDictOfHandleD :: HandleD h -> HandleDict h
handleDictImpl :: Handle h => HandleDict h
handleOneWayCoercible :: forall h. (forall e es. e <: es => OneWayCoercible (h e) (h es)) => HandleD h

-- | It is not always possible to derive an instance of
--   <a>OneWayCoercible</a>. In such cases write a definition of
--   <a>oneWayCoercibleImpl</a> using <tt>oneWayCoercibleTrustMe</tt>. Its
--   argument must be a total function mapping the effect parameter of
--   <tt>h</tt>. Normally you'll write the function by mapping the
--   constitients of <tt>h</tt> using the functions in this module like
--   <a>mapHandle</a>, <a>useImpl</a> and <a>useImplUnder</a>.
--   
--   If this function is not total then it's possible you are violating the
--   type system, which could lead to segfaults or worse. It's not easy to
--   supply a partial function by accident, but be careful! (N.B. it must
--   not be literally <tt>mapHandle</tt> otherwise you'll have a circular
--   definition!)
oneWayCoercibleTrustMe :: e <: es => (forall e' es'. e' <: es' => h e' -> h es') -> OneWayCoercibleD (h e) (h es)

-- | <a>OneWayCoercibleHandle</a> is used to derive <a>Handle</a> instances
--   using <tt>DerivingVia</tt>. Make sure you import the constructor, for
--   example using a wildcard import like this
--   
--   <pre>
--   import Bluefin.Compound (OneWayCoercibleHandle (..))
--   </pre>
--   
--   because if you <i>only</i> import the type like this
--   
--   <pre>
--   import Bluefin.Compound (OneWayCoercibleHandle)
--   </pre>
--   
--   then <tt>deriving via OneWayCoercibleHandle ...</tt> will not work.
--   The constructor needs to be in scope.
newtype OneWayCoercibleHandle a es
MkOneWayCoercibleHandle :: a es -> OneWayCoercibleHandle a es

-- | A convenience type whose only purpose is to avoid writing <tt>(#
--   #)</tt> as an argument to functions which are only functions because
--   top-level definitions of unlifted kind are forbidden.
newtype ZW
MkZW :: (# #) -> ZW
pattern ZW :: ZW
newtype In (a :: Effects) (b :: Effects)
In# :: (# #) -> In (a :: Effects) (b :: Effects)
unsafeInAxiom :: ZW -> e1 `In` e2
merge :: ZW -> (a :& a) `In` a
eq :: ZW -> a `In` a
fstI :: ZW -> a `In` (a :& b)
sndI :: ZW -> a `In` (b :& a)
cmp :: (a `In` b) -> (b `In` c) -> a `In` c
bimap :: (a `In` b) -> (c `In` d) -> (a :& c) `In` (b :& d)
assoc1 :: ZW -> ((a :& b) :& c) `In` (a :& (b :& c))
drop :: (a `In` b) -> a `In` (c :& b)
here :: (a `In` b) -> a `In` (b :& c)
w :: ((a :& b) `In` c) -> a `In` c
w2 :: ((b :& a) `In` c) -> a `In` c
b2 :: (a `In` b) -> (a :& c) `In` (b :& c)
b :: (a `In` b) -> (c :& a) `In` (c :& b)
subsume1 :: (e2 `In` e1) -> (e1 :& e2) `In` e1
subsume2 :: (e1 `In` e2) -> (e1 :& e2) `In` e2

-- | The subset constraint on sets of effect tags
--   
--   Please use the type synonym <a>&lt;:</a> instead of <tt>:&gt;</tt>.
--   The former is a better name for this constraint and <tt>:&gt;</tt>
--   will be renamed <tt>&lt;:</tt> in a future version.
class (es1 :: Effects) :> (es2 :: Effects)

-- | The subset constraint on sets of effect tags. <tt>&lt;:</tt> is a type
--   operator (see the extension <tt>TypeOperators</tt>) so in order to
--   import it you need to use the <tt>ExplicitNamespaces</tt> extension
--   and the <tt>type</tt> import qualifier, like this:
--   
--   <pre>
--   {-# LANUGAGE ExplicitNamespaces #-}
--   import Bluefin.Eff (type (&lt;:))
--   </pre>
--   
--   "<tt>&lt;:</tt>" is a synonym for "<a>:&gt;</a>". "<tt>&lt;:</tt>" is
--   a better name for this constraint than "<tt>:&gt;</tt>" because it is
--   more evocative of mathematical relations like <tt>&lt;</tt>,
--   <tt>&lt;=</tt>, <tt>⊂</tt> and <tt>⊆</tt> which hold when the argument
--   on the left of the operator is "smaller than" the argument on the
--   right. In the case of <tt>&lt;:</tt> we have that <tt>e1 &lt;: e2</tt>
--   when the set of effect tags <tt>e1</tt> is a subset of or equal to
--   <tt>e2</tt>, i.e. "<tt>e1</tt> is smaller than (or equal to)
--   <tt>e2</tt>". For example, the following constraints hold (note that
--   <a>:&amp;</a> is the union of sets of effect tags):
--   
--   <ul>
--   <li><pre>e &lt;: e</pre></li>
--   <li><pre>e &lt;: (e1 :&amp; ... :&amp; e :&amp; ... :&amp;
--   en)</pre></li>
--   </ul>
type (<:) = (:>)
instanceProof1 :: ZW -> e `In` e
instanceProof2 :: (e `In` es) -> e `In` (x :& es)
instanceProof3 :: ZW -> e `In` (e :& es)
subset :: forall e1 es m. Monad m => e1 <: es => m ()
satisfied :: forall c m. (Monad m, c) => m ()
effTag :: Eff es (Proxy es)
handleTag :: h e -> Eff es (Proxy e)

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ try $ \e -&gt; do
--         throw e 42
--         pure "No exception thrown"
--   Left 42
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ try $ \e -&gt; do
--         pure "No exception thrown"
--   Right "No exception thrown"
--   </pre>
throw :: e <: es => Exception ex e -> ex -> Eff es a
has :: forall a b. a <: b => a `In` b
data Dict c
[Dict] :: forall c. c => Dict c
unsafeCoerceDict :: forall c c'. Dict c -> Dict c'
have :: forall a b. (a `In` b) -> Dict (a <: b)

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ try $ \e -&gt; do
--         throw e 42
--         pure "No exception thrown"
--   Left 42
--   </pre>
try :: forall exn (es :: Effects) a. (forall e. Exception exn e -> Eff (e :& es) a) -> Eff es (Either exn a)

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ handle (pure . show) $ \e -&gt; do
--         throw e 42
--         pure "No exception thrown"
--   "42"
--   </pre>
handle :: forall exn (es :: Effects) a. (exn -> Eff es a) -> (forall e. Exception exn e -> Eff (e :& es) a) -> Eff es a

-- | <a>handle</a>, but with the argument order swapped
catch :: forall exn (es :: Effects) a. (forall e. Exception exn e -> Eff (e :& es) a) -> (exn -> Eff es a) -> Eff es a

-- | Rethrow an exception raised by an <a>IO</a> action as a Bluefin
--   exception.
--   
--   <pre>
--   <a>runEff</a> $ \io -&gt; do
--     r &lt;- <a>try</a> $ \ex -&gt; do
--       rethrowIO @<a>IOException</a> io ex $ do
--         effIO io (<a>readFile</a> "/tmp/doesnt-exist")
--   
--     <a>effIO</a> io $ putStrLn $ case r of
--       Left e -&gt; "Caught IOException:\n" ++ show e
--       Right contents -&gt; contents
--   </pre>
--   
--   <pre>
--   Caught IOException:
--   /tmp/doesnt-exist: openFile: does not exist (No such file or directory)
--   </pre>
rethrowIO :: forall ex es e1 e2 r. (e1 <: es, e2 <: es, Exception ex) => IOE e1 -> Exception ex e2 -> Eff es r -> Eff es r

-- | <tt>bracket acquire release body</tt>: <tt>acquire</tt> a resource,
--   perform the <tt>body</tt> with it, and <tt>release</tt> the resource
--   even if <tt>body</tt> threw an exception. This is essentially the same
--   as <tt>Control.Exception.<a>bracket</a></tt>, whose documentation you
--   can inspect for further details.
--   
--   <tt>bracket</tt> has a very general type that does not require
--   <tt>es</tt> to contain an exception or IO effect. The reason that this
--   is safe is:
--   
--   <ul>
--   <li>While <tt>bracket</tt> does catch exceptions, this is
--   unobservable, since the exception is re-thrown; the cleanup action
--   happens unconditionally; and no part of it gets access to the thrown
--   exception.</li>
--   <li><a>Eff</a> itself is able to guarantee that any exceptions thrown
--   in the body will be actually thrown before <tt>bracket</tt> exits.
--   This is inherited from the fact that <tt>Eff</tt> is a wrapper around
--   <a>IO</a>.</li>
--   </ul>
--   
--   While it is usually the case that the cleanup action will in fact want
--   to use <tt>IO</tt> effects, this is not universally true, see the
--   <tt>polymorphicBracket</tt> example for an example.
bracket :: Eff es a -> (a -> Eff es ()) -> (a -> Eff es b) -> Eff es b

-- | A simpler variant of <a>bracket</a> for use when you don't need to
--   acquire a resource.
finally :: Eff es b -> Eff es () -> Eff es b
withStateInIO :: (e1 <: es, e2 <: es) => IOE e1 -> State s e2 -> (IORef s -> IO r) -> Eff es r

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ runState 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (2 * n)
--   (20,10)
--   </pre>
get :: e <: es => State s e -> Eff es s

-- | Set the value of the state
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ runState 10 $ \st -&gt; do
--         put st 30
--   ((), 30)
--   </pre>
put :: e <: es => State s e -> s -> Eff es ()

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ runState 10 $ \st -&gt; do
--         modify st (* 2)
--   ((), 20)
--   </pre>
modify :: e <: es => State s e -> (s -> s) -> Eff es ()
withScopedException_ :: ((forall a. e -> IO a) -> IO r) -> IO (Either e r)

-- | <pre>
--   <a>runPureEff</a> $ <a>withStateSource</a> $ \source -&gt; do
--     n &lt;- <a>newState</a> source 5
--     total &lt;- newState source 0
--   
--     <a>withJump</a> $ \done -&gt; forever $ do
--       n' &lt;- <a>get</a> n
--       <a>modify</a> total (+ n')
--       when (n' == 0) $ <a>jumpTo</a> done
--       modify n (subtract 1)
--   
--     get total
--   15
--   </pre>
withStateSource :: (forall e. StateSource e -> Eff (e :& es) a) -> Eff es a

-- | <pre>
--   runPureEff $ <a>withStateSource</a> $ \source -&gt; do
--     n &lt;- <a>newState</a> source 5
--     total &lt;- newState source 0
--   
--     <a>withJump</a> $ \done -&gt; forever $ do
--       n' &lt;- <a>get</a> n
--       <a>modify</a> total (+ n')
--       when (n' == 0) $ <a>jumpTo</a> done
--       modify n (subtract 1)
--   
--     get total
--   15
--   </pre>
newState :: e <: es => StateSource e -> s -> Eff es (State s e)

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ runState 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (2 * n)
--   (20,10)
--   </pre>
runState :: s -> (forall e. State s e -> Eff (e :& es) a) -> Eff es (a, s)
yieldCoroutine :: e1 <: es => Coroutine a b e1 -> a -> Eff es b

-- | Yield an element to the stream.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToList $ \y -&gt; do
--         yield y 1
--         yield y 2
--         yield y 100
--   ([1,2,100], ())
--   </pre>
yield :: e1 <: es => Stream a e1 -> a -> Eff es ()
handleCoroutine :: (a -> Eff es b) -> (z -> Eff es r) -> (forall e1. Coroutine a b e1 -> Eff (e1 :& es) z) -> Eff es r

-- | Apply an effectful function to each element yielded to the stream.
--   
--   <pre>
--   &gt;&gt;&gt; <a>runPureEff</a> $ <a>yieldToList</a> $ \y -&gt; do
--         <a>forEach</a> (<a>inFoldable</a> [0 .. 3]) $ \i -&gt; do
--           <a>yield</a> y i
--           yield y (i * 10)
--   ([0, 0, 1, 10, 2, 20, 3, 30], ())
--   </pre>
forEach :: (forall e1. Coroutine a b e1 -> Eff (e1 :& es) r) -> (a -> Eff es b) -> Eff es r

-- | Ignore all elements yielded to the stream.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ ignoreStream $ \y -&gt; do
--        for_ [0 .. 4] $ \i -&gt; do
--          yield y i
--          yield y (i * 10)
--   
--        pure 42
--   42
--   </pre>
ignoreStream :: (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Eff es r

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToList $ inFoldable [1, 2, 100]
--   ([1, 2, 100], ())
--   </pre>
inFoldable :: (Foldable t, e1 <: es) => t a -> Stream a e1 -> Eff es ()

-- | Pair each element in the stream with an increasing index, starting
--   from 0.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToList $ enumerate (inFoldable ["A", "B", "C"])
--   ([(0, "A"), (1, "B"), (2, "C")], ())
--   </pre>
enumerate :: e2 <: es => (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Stream (Int, a) e2 -> Eff es r

-- | Pair each element in the stream with an increasing index, starting
--   from an inital value.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToList $ enumerateFrom 1 (inFoldable ["A", "B", "C"])
--   ([(1, "A"), (2, "B"), (3, "C")], ())
--   </pre>
enumerateFrom :: e2 <: es => Int -> (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Stream (Int, a) e2 -> Eff es r

-- | A version of <a>forEach</a> specialized to <tt>Consume</tt>. Every
--   time the <tt>Consume</tt> is used to <a>await</a> a <tt>b</tt>, feed
--   it the one created by the handler.
consumeEach :: (forall e. Consume b e -> Eff (e :& es) r) -> Eff es b -> Eff es r
await :: e <: es => Consume a e -> Eff es a
type EarlyReturn = Exception

-- | Run an <a>Eff</a> action with the ability to return early to this
--   point. In the language of exceptions, <a>withEarlyReturn</a> installs
--   an exception handler for an exception of type <tt>r</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ withEarlyReturn $ \e -&gt; do
--         for_ [1 .. 10] $ \i -&gt; do
--           when (i &gt;= 5) $
--             returnEarly e ("Returned early with " ++ show i)
--         pure "End of loop"
--   "Returned early with 5"
--   </pre>
withEarlyReturn :: (forall e. EarlyReturn r e -> Eff (e :& es) r) -> Eff es r

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ withEarlyReturn $ \e -&gt; do
--         for_ [1 .. 10] $ \i -&gt; do
--           when (i &gt;= 5) $
--             returnEarly e ("Returned early with " ++ show i)
--         pure "End of loop"
--   "Returned early with 5"
--   </pre>
returnEarly :: e <: es => EarlyReturn r e -> r -> Eff es a

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ evalState 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (2 * n)
--   20
--   </pre>
evalState :: s -> (forall e. State s e -> Eff (e :& es) a) -> Eff es a

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ withState 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (s -&gt; (2 * n, s))
--   (20,10)
--   </pre>
withState :: s -> (forall e. State s e -> Eff (e :& es) (s -> a)) -> Eff es a
data Compound e1 e2 ss
[Compound] :: Proxy# s1 -> Proxy# s2 -> e1 s1 -> e2 s2 -> Compound e1 e2 (s1 :& s2)
compound :: h1 e1 -> h2 e2 -> Compound h1 h2 (e1 :& e2)
inComp :: forall a b c r. a <: b => b <: c => (a <: c => r) -> r
withCompound :: forall h1 h2 e es r. e <: es => Compound h1 h2 e -> (forall e1 e2. (e1 <: es, e2 <: es) => h1 e1 -> h2 e2 -> Eff es r) -> Eff es r
withC1 :: forall e1 e2 ss es r. ss <: es => Compound e1 e2 ss -> (forall st. st <: es => e1 st -> Eff es r) -> Eff es r
withC2 :: forall e1 e2 ss es r. ss <: es => Compound e1 e2 ss -> (forall st. st <: es => e2 st -> Eff es r) -> Eff es r
putC :: forall ss es e. ss <: es => Compound e (State Int) ss -> Int -> Eff es ()
getC :: forall ss es e. ss <: es => Compound e (State Int) ss -> Eff es Int
runCompound :: e1 s1 -> e2 s2 -> (forall es'. Compound e1 e2 es' -> Eff (es' :& es) r) -> Eff (s1 :& (s2 :& es)) r

-- | Gather all yielded elements into a list.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToList $ \y -&gt; do
--         yield y 1
--         yield y 2
--         yield y 100
--   ([1,2,100], ())
--   </pre>
yieldToList :: (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Eff es ([a], r)

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ withYieldToList $ \y -&gt; do
--     yield y 1
--     yield y 2
--     yield y 100
--     pure length
--   3
--   </pre>
withYieldToList :: (forall e. Stream a e -> Eff (e :& es) ([a] -> r)) -> Eff es r

-- | This is more efficient than <a>yieldToList</a> because it gathers the
--   elements into a stack in reverse order. <tt>yieldToList</tt> then
--   reverses that stack.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ yieldToReverseList $ \y -&gt; do
--         yield y 1
--         yield y 2
--         yield y 100
--   ([100,2,1], ())
--   </pre>
yieldToReverseList :: (forall e. Stream a e -> Eff (e :& es) r) -> Eff es ([a], r)
mapMaybe :: e2 <: es => (a -> Maybe b) -> (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Stream b e2 -> Eff es r

-- | Remove <a>Nothing</a> elements from a stream.
catMaybes :: e2 <: es => (forall e1. Stream (Maybe a) e1 -> Eff (e1 :& es) r) -> Stream a e2 -> Eff es r

-- | <pre>
--   runPureEff $ yieldToList $ yOut -&gt; do
--     consumeStream
--       (\c -&gt; takeConsume 6 c yOut)
--       (\yIn -&gt; cycleToStream [1..3] yIn)
--   ([1,2,3,1,2,3],())
--   </pre>
cycleToStream :: (Foldable f, e1 <: es) => f a -> Stream a e1 -> Eff es ()

-- | <pre>
--   runPureEff $ yieldToList $ yOut -&gt; do
--     consumeStream
--       (\c -&gt; takeConsume 4 c yOut)
--       (\yIn -&gt; inFoldable [1..10] yIn)
--   ([1,2,3,4],())
--   </pre>
takeConsume :: (e1 <: es, e2 <: es) => Int -> Consume a e1 -> Stream a e2 -> Eff es ()
type Jump = EarlyReturn ()

-- | <pre>
--   runPureEff $ <a>withStateSource</a> $ \source -&gt; do
--     n &lt;- <a>newState</a> source 5
--     total &lt;- newState source 0
--   
--     <a>withJump</a> $ \done -&gt; forever $ do
--       n' &lt;- <a>get</a> n
--       <a>modify</a> total (+ n')
--       when (n' == 0) $ <a>jumpTo</a> done
--       modify n (subtract 1)
--   
--     get total
--   15
--   </pre>
withJump :: (forall e. Jump e -> Eff (e :& es) ()) -> Eff es ()

-- | <pre>
--   runPureEff $ <a>withStateSource</a> $ \source -&gt; do
--     n &lt;- <a>newState</a> source 5
--     total &lt;- newState source 0
--   
--     <a>withJump</a> $ \done -&gt; forever $ do
--       n' &lt;- <a>get</a> n
--       <a>modify</a> total (+ n')
--       when (n' == 0) $ <a>jumpTo</a> done
--       modify n (subtract 1)
--   
--     get total
--   15
--   </pre>
jumpTo :: e <: es => Jump e -> Eff es a
unwrap :: e <: es => Jump e -> Maybe a -> Eff es a

-- | Capability to run <a>IO</a> operations
data IOE (e :: Effects)
MkIOE :: IOE (e :: Effects)

-- | Run an <a>IO</a> operation in <a>Eff</a>
--   
--   <pre>
--   &gt;&gt;&gt; runEff $ \io -&gt; do
--         effIO io (putStrLn "Hello world!")
--   Hello, world!
--   </pre>
effIO :: e <: es => IOE e -> IO a -> Eff es a

-- | Run an <a>Eff</a> whose only unhandled effect is <a>IO</a>.
--   
--   <pre>
--   &gt;&gt;&gt; runEff $ \io -&gt; do
--         effIO io (putStrLn "Hello world!")
--   Hello, world!
--   </pre>
runEff :: (forall e. IOE e -> Eff e a) -> IO a

-- | Run an <a>Eff</a> whose only unhandled effect is <a>IO</a>.
--   
--   <pre>
--   &gt;&gt;&gt; runEff_ $ \io -&gt; do
--         effIO io (putStrLn "Hello world!")
--   Hello, world!
--   </pre>
--   
--   Use <a>runEff</a> instead. <tt>runEff_</tt> will be deprecated in a
--   future version.
runEff_ :: (forall e. IOE e -> Eff e a) -> IO a
unsafeProvideIO :: (forall e. IOE e -> Eff (e :& es) a) -> Eff es a
connect :: (forall e1. Coroutine a b e1 -> Eff (e1 :& es) r1) -> (forall e2. a -> Coroutine b a e2 -> Eff (e2 :& es) r2) -> forall e1 e2. (e1 <: es, e2 <: es) => Eff es (Either (r1, a -> Coroutine b a e2 -> Eff es r2) (r2, b -> Coroutine a b e1 -> Eff es r1))
head' :: forall a b r es. (forall e. Coroutine a b e -> Eff (e :& es) r) -> forall e. e <: es => Eff es (Either r (a, b -> Coroutine a b e -> Eff es r))
newtype Writer w e
Writer :: Stream w e -> Writer w e

-- | <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ snd $ runPureEff $ runWriter $ \w -&gt; do
--         -- Non-empty list (the tell event does happen)
--         for_ [1 .. 10] $ \_ -&gt; tell w (<a>Any</a> True)
--   True
--   </pre>
runWriter :: Monoid w => (forall e. Writer w e -> Eff (e :& es) r) -> Eff es (r, w)

-- | <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ runPureEff $ execWriter $ \w -&gt; do
--         -- Non-empty list (the tell event does happen)
--         for_ [1 .. 10] $ \_ -&gt; tell w (<a>Any</a> True)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ runPureEff $ execWriter $ \w -&gt; do
--         -- Empty list (the tell event does not happen)
--         for_ [] $ \_ -&gt; tell w (<a>Any</a> True)
--   False
--   </pre>
execWriter :: Monoid w => (forall e. Writer w e -> Eff (e :& es) r) -> Eff es w

-- | <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ runPureEff $ execWriter $ \w -&gt; do
--         -- Non-empty list (the tell event does happen)
--         for_ [1 .. 10] $ \_ -&gt; tell w (<a>Any</a> True)
--   True
--   </pre>
tell :: e <: es => Writer w e -> w -> Eff es ()
newtype Reader r e
MkReader :: Key r -> Reader r e
runReader :: r -> (forall e. Reader r e -> Eff (e :& es) a) -> Eff es a

-- | Read the value. Note that <tt>ask</tt> has the property that these two
--   operations are always equivalent:
--   
--   <pre>
--   do
--     r1 &lt;- ask re
--     r2 &lt;- ask re
--     pure (r1, r2)
--   </pre>
--   
--   <pre>
--   do
--     r &lt;- ask re
--     pure (r, r)
--   </pre>
ask :: e <: es => Reader r e -> Eff es r

-- | Read the value modified by a function
asks :: e <: es => Reader r e -> (r -> a) -> Eff es a

-- | Locally override the value in the <tt>Reader</tt>. It will be restored
--   when the <tt>local</tt> block ends.
local :: e1 <: es => Reader r e1 -> (r -> r) -> Eff es a -> Eff es a
newtype HandleReader h e
UnsafeMkHandleReader :: Reader (h e) e -> HandleReader h e
mapHandleReader :: forall h e es. (Handle h, e <: es) => HandleReader h e -> HandleReader h es
localHandle :: (e <: es, Handle h) => HandleReader h e -> (h es -> h es) -> Eff es r -> Eff es r
askHandle :: (e <: es, Handle h) => HandleReader h e -> Eff es (h es)
asksHandle :: (e1 <: es, Handle h) => HandleReader h e1 -> (forall e. h e -> Eff (e :& es) r) -> Eff es r
runHandleReader :: (e1 <: es, Handle h) => h e1 -> (forall e. HandleReader h e -> Eff (e :& es) r) -> Eff es r
newtype ConstEffect r (e :: Effects)
MkConstEffect :: r -> ConstEffect r (e :: Effects)
runConstEffect :: r -> (forall e. ConstEffect r e -> Eff (e :& es) a) -> Eff es a
type Ask = Reader
type AskCapability = HandleReader

-- | Capability to await values of type <tt>a</tt>
type Await a = Consume a
type JumpTo = Jump

-- | Capability to yield a value of type <tt>a</tt> and then await a value
--   of type <tt>b</tt> in response.
type Request = Coroutine
type ReturnEarly = EarlyReturn

-- | Capability to modify a reference to an <tt>s</tt>
type Modify = State
type Tell = Writer

-- | Capability to throw an exception of type <tt>exn</tt>
type Throw = Exception

-- | Capability to yield values of type <tt>a</tt>. It is implemented as a
--   <a>Request</a> capability that can yield values of type <tt>a</tt> and
--   then await values of type <tt>()</tt>.
type Yield a = Stream a
runAsk :: r -> (forall e. Ask r e -> Eff (e :& es) a) -> Eff es a

-- | Interleave the execution of two Bluefin operations by sending their
--   requests to each other. <tt>a</tt>s are sent from the first to the
--   second which responds by returning <tt>b</tt>s. The first runs until
--   it yields its first <tt>a</tt> it starts the second (which is awaiting
--   an <tt>a</tt>).
connectRequests :: forall es a b r. (forall e. Request a b e -> Eff (e :& es) r) -> (forall e. a -> Request b a e -> Eff (e :& es) r) -> Eff es r
request :: e1 <: es => Request a b e1 -> a -> Eff es b

-- | <a>awaitYield</a> is <a>connectRequests</a> specialized to
--   <tt>Await</tt> and <tt>Yield</tt>, which is the most common case.
awaitYield :: (forall e. Await a e -> Eff (e :& es) r) -> (forall e. Yield a e -> Eff (e :& es) r) -> Eff es r

-- | A version of <a>forEach</a> specialized to <tt>Await</tt>. Every time
--   the <tt>Await</tt> is used to <a>await</a> a <tt>b</tt>, feed it the
--   one created by the handler.
eachAwait :: (forall e. Await b e -> Eff (e :& es) r) -> Eff es b -> Eff es r

-- | <pre>
--   runPureEff $ yieldToList $ yOut -&gt; do
--     awaitYield
--       (\c -&gt; takeAwait 4 c yOut)
--       (\yIn -&gt; inFoldable [1..10] yIn)
--   ([1,2,3,4],())
--   </pre>
takeAwait :: (e1 <: es, e2 <: es) => Int -> Await a e1 -> Yield a e2 -> Eff es ()

-- | Ignore all yielded elements.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ ignoreYield $ \y -&gt; do
--        for_ [0 .. 4] $ \i -&gt; do
--          yield y i
--          yield y (i * 10)
--   
--        pure 42
--   42
--   </pre>
ignoreYield :: (forall e1. Stream a e1 -> Eff (e1 :& es) r) -> Eff es r

-- | <pre>
--   runPureEff $ yieldToList $ yOut -&gt; do
--     consumeStream
--       (\c -&gt; takeAwait 6 c yOut)
--       (\yIn -&gt; cycleToYield [1..3] yIn)
--   ([1,2,3,1,2,3],())
--   </pre>
cycleToYield :: (Foldable f, e1 <: es) => f a -> Yield a e1 -> Eff es ()

-- | Run an <a>Eff</a> action with the ability to return early to this
--   point. In the language of exceptions, <tt>withReturnEarly</tt>
--   installs an exception handler for an exception of type <tt>r</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; runPureEff $ withReturnEarly $ \e -&gt; do
--         for_ [1 .. 10] $ \i -&gt; do
--           when (i &gt;= 5) $
--             returnEarly e ("Returned early with " ++ show i)
--         pure "End of loop"
--   "Returned early with 5"
--   </pre>
withReturnEarly :: (forall e. EarlyReturn r e -> Eff (e :& es) r) -> Eff es r

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ evalModify 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (2 * n)
--   20
--   </pre>
evalModify :: s -> (forall e. Modify s e -> Eff (e :& es) a) -> Eff es a

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ withModify 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (s -&gt; (2 * n, s))
--   (20,10)
--   </pre>
withModify :: s -> (forall e. Modify s e -> Eff (e :& es) (s -> a)) -> Eff es a

-- | <pre>
--   &gt;&gt;&gt; runPureEff $ runModify 10 $ \st -&gt; do
--         n &lt;- get st
--         pure (2 * n)
--   (20,10)
--   </pre>
runModify :: s -> (forall e. Modify s e -> Eff (e :& es) a) -> Eff es (a, s)

-- | <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ snd $ runPureEff $ runTell $ \w -&gt; do
--         -- Non-empty list (the tell event does happen)
--         for_ [1 .. 10] $ \_ -&gt; tell w (<a>Any</a> True)
--   True
--   </pre>
runTell :: Monoid w => (forall e. Tell w e -> Eff (e :& es) r) -> Eff es (r, w)

-- | <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ runPureEff $ execTell $ \w -&gt; do
--         -- Non-empty list (the tell event does happen)
--         for_ [1 .. 10] $ \_ -&gt; tell w (<a>Any</a> True)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; <a>getAny</a> $ runPureEff $ execTell $ \w -&gt; do
--         -- Empty list (the tell event does not happen)
--         for_ [] $ \_ -&gt; tell w (<a>Any</a> True)
--   False
--   </pre>
execTell :: Monoid w => (forall e. Tell w e -> Eff (e :& es) r) -> Eff es w
runAskCapability :: (e1 <: es, Handle h) => h e1 -> (forall e. HandleReader h e -> Eff (e :& es) r) -> Eff es r
askCapability :: (e <: es, Handle h) => HandleReader h e -> Eff es (h es)
asksCapability :: (e1 <: es, Handle h) => AskCapability h e1 -> (forall e. h e -> Eff (e :& es) r) -> Eff es r
localCapability :: (e <: es, Handle h) => AskCapability h e -> (h es -> h es) -> Eff es r -> Eff es r

-- | <pre>
--   runPureEff $ <a>withStateSource</a> $ \source -&gt; do
--     n &lt;- <a>newState</a> source 5
--     total &lt;- newState source 0
--   
--     <a>withJumpTo</a> $ \done -&gt; forever $ do
--       n' &lt;- <a>get</a> n
--       <a>modify</a> total (+ n')
--       when (n' == 0) $ <a>jumpTo</a> done
--       modify n (subtract 1)
--   
--     get total
--   15
--   </pre>
withJumpTo :: (forall e. JumpTo e -> Eff (e :& es) ()) -> Eff es ()
instance Control.Monad.Fix.MonadFix (Bluefin.Internal.Eff es)
instance GHC.Base.Monad (Bluefin.Internal.Eff es)
instance GHC.Base.Applicative (Bluefin.Internal.Eff es)
instance GHC.Base.Functor (Bluefin.Internal.Eff es)
instance GHC.Base.Monad (Bluefin.Internal.EffReader r es)
instance GHC.Base.Applicative (Bluefin.Internal.EffReader r es)
instance GHC.Base.Functor (Bluefin.Internal.EffReader r es)
instance forall k (a :: k -> *) (es :: k). GHC.Generics.Generic (Bluefin.Internal.OneWayCoercibleHandle a es)
instance Bluefin.Internal.Handle (Bluefin.Internal.Coroutine a b)
instance Bluefin.Internal.Handle (Bluefin.Internal.State s)
instance Bluefin.Internal.Handle (Bluefin.Internal.Exception exn)
instance Bluefin.Internal.Handle Bluefin.Internal.IOE
instance Bluefin.Internal.Handle (Bluefin.Internal.Writer w)
instance Bluefin.Internal.Handle (Bluefin.Internal.Reader r)
instance Bluefin.Internal.Handle (Bluefin.Internal.HandleReader h)
instance Bluefin.Internal.Handle (Bluefin.Internal.ConstEffect r)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.ConstEffect r e) (Bluefin.Internal.ConstEffect r es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.HandleReader h e) (Bluefin.Internal.HandleReader h es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Reader r e) (Bluefin.Internal.Reader r es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Writer w e) (Bluefin.Internal.Writer w es)
instance (e Bluefin.Internal.<: es) => Control.Monad.IO.Class.MonadIO (Bluefin.Internal.EffReader (Bluefin.Internal.IOE e) es)
instance (e Bluefin.Internal.<: es) => Control.Monad.IO.Unlift.MonadUnliftIO (Bluefin.Internal.EffReader (Bluefin.Internal.IOE e) es)
instance (e Bluefin.Internal.<: es) => Control.Monad.Base.MonadBase GHC.Types.IO (Bluefin.Internal.EffReader (Bluefin.Internal.IOE e) es)
instance (e Bluefin.Internal.<: es) => Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO (Bluefin.Internal.EffReader (Bluefin.Internal.IOE e) es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.IOE e) (Bluefin.Internal.IOE es)
instance (e Bluefin.Internal.<: es) => Control.Monad.Fail.MonadFail (Bluefin.Internal.EffReader (Bluefin.Internal.Exception GHC.Base.String e) es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Exception ex e) (Bluefin.Internal.Exception ex es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.State s e) (Bluefin.Internal.State s es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Coroutine a b e) (Bluefin.Internal.Coroutine a b es)
instance Bluefin.Internal.Handle h => Bluefin.Internal.Handle (GHC.Generics.Rec1 h)
instance Bluefin.Internal.Handle h => Bluefin.Internal.Handle (GHC.Generics.M1 i t h)
instance (Bluefin.Internal.Handle h1, Bluefin.Internal.Handle h2) => Bluefin.Internal.Handle (h1 GHC.Generics.:*: h2)
instance (forall (e' :: Bluefin.Internal.Effects) (es' :: Bluefin.Internal.Effects). (e' Bluefin.Internal.<: es') => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.OneWayCoercibleHandle h e') (Bluefin.Internal.OneWayCoercibleHandle h es')) => Bluefin.Internal.Handle (Bluefin.Internal.OneWayCoercibleHandle h)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Eff e) (Bluefin.Internal.Eff es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Eff e r) (Bluefin.Internal.Eff es r)
instance e Bluefin.Internal.:> e
instance (e Bluefin.Internal.:> es) => e Bluefin.Internal.:> (x Bluefin.Internal.:& es)
instance e Bluefin.Internal.:> (e Bluefin.Internal.:& es)
instance forall k (h :: k -> *) (e :: k) (es :: k). Bluefin.Internal.OneWayCoercible.OneWayCoercible (h e) (h es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.OneWayCoercibleHandle h e) (Bluefin.Internal.OneWayCoercibleHandle h es)

module Bluefin.Internal.System.IO
data Handle e
UnsafeMkHandle :: Handle -> IOE e -> Handle e
withFile :: e1 <: es => IOE e1 -> FilePath -> IOMode -> (forall e. Handle e -> Eff (e :& es) r) -> Eff es r
hPutChar :: e <: es => Handle e -> Char -> Eff es ()

-- | If there's a <a>System.IO.Handle</a>-using function you need that
--   isn't included here then you can <a>open an issue</a> to request it be
--   added. In the meantime you can define it yourself with
--   <tt>unsafeWithHandle</tt>.
unsafeWithHandle :: e1 <: es => Handle e1 -> (Handle -> IO r) -> Eff es r
hPutStr :: e <: es => Handle e -> String -> Eff es ()
hPutStrLn :: e <: es => Handle e -> String -> Eff es ()
hFlush :: e <: es => Handle e -> Eff es ()
hGetLine :: e <: es => Handle e -> Eff es String
hIsEOF :: e <: es => Handle e -> Eff es Bool
data () => IOMode
ReadMode :: IOMode
WriteMode :: IOMode
AppendMode :: IOMode
ReadWriteMode :: IOMode
instance Bluefin.Internal.Handle Bluefin.Internal.System.IO.Handle
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.System.IO.Handle e) (Bluefin.Internal.System.IO.Handle es)

module Bluefin.Internal.Prim
data Prim (e :: Effects)
UnsafeMkPrim :: Prim (e :: Effects)
data PrimStateEff (es :: Effects)
runPrim :: (forall e. Prim e -> Eff (e :& es) r) -> Eff es r
type StateM s a = State# s -> (# State# s, a #)
unsafeCoerceStateM :: forall s1 s2 a. StateM s1 a -> StateM s2 a
primitive :: forall e1 es a. e1 <: es => Prim e1 -> (State# (PrimStateEff e1) -> (# State# (PrimStateEff e1), a #)) -> Eff es a
instance Bluefin.Internal.Handle Bluefin.Internal.Prim.Prim
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Prim.Prim e) (Bluefin.Internal.Prim.Prim es)

module Bluefin.Internal.Pipes
data Proxy a' a b' b e
MkProxy :: Coroutine a' a e -> Coroutine b b' e -> Proxy a' a b' b e
type Pipe a = Proxy () a ()
type Producer = Proxy Void () ()
type Consumer a = Pipe a Void
type Effect = Producer Void
(>->) :: e1 <: es => (forall e. Proxy a' a () b e -> Eff (e :& es) r) -> (forall e. Proxy () b c' c e -> Eff (e :& es) r) -> Proxy a' a c' c e1 -> Eff es r
infixl 7 >->
(<-<) :: e1 <: es => (forall e. Proxy () b c' c e -> Eff (e :& es) r) -> (forall e. Proxy a' a () b e -> Eff (e :& es) r) -> Proxy a' a c' c e1 -> Eff es r
infixr 7 <-<
for :: e1 <: es => (forall e. Proxy x' x b' b e -> Eff (e :& es) a') -> (b -> forall e. Proxy x' x c' c e -> Eff (e :& es) b') -> Proxy x' x c' c e1 -> Eff es a'
(~>) :: e1 <: es => (a -> forall e. Proxy x' x b' b e -> Eff (e :& es) a') -> (b -> forall e. Proxy x' x c' c e -> Eff (e :& es) b') -> a -> Proxy x' x c' c e1 -> Eff es a'
infixr 4 ~>
(<~) :: e1 <: es => (b -> forall e. Proxy x' x c' c e -> Eff (e :& es) b') -> (a -> forall e. Proxy x' x b' b e -> Eff (e :& es) a') -> a -> Proxy x' x c' c e1 -> Eff es a'
infixl 4 <~
reverseProxy :: Proxy a' a b' b e -> Proxy b b' a a' e
(>~) :: e1 <: es => (forall e. Proxy a' a y' y e -> Eff (e :& es) b) -> (forall e. Proxy () b y' y e -> Eff (e :& es) c) -> Proxy a' a y' y e1 -> Eff es c
infixl 5 >~
(~<) :: e1 <: es => (forall e. Proxy () b y' y e -> Eff (e :& es) c) -> (forall e. Proxy a' a y' y e -> Eff (e :& es) b) -> Proxy a' a y' y e1 -> Eff es c
infixr 5 ~<
cat :: Pipe a a e -> Eff (e :& es) r
runEffect :: (forall e. Effect e -> Eff (e :& es) r) -> Eff es r
yield :: e <: es => Proxy x1 x () a e -> a -> Eff es ()
await :: e <: es => Proxy () a y' y e -> Eff es a

-- | <tt>pipe</tt>'s <a>next</a> doesn't exist in Bluefin
next :: ()
each :: Foldable f => f a -> Proxy x' x () a e -> Eff (e :& es) ()
repeatM :: e <: es => Eff es a -> Proxy x' x () a e -> Eff es r
replicateM :: e <: es => Int -> Eff es a -> Proxy x' x () a e -> Eff es ()
print :: (e2 <: es, e1 <: es, Show a) => IOE e1 -> Consumer a e2 -> Eff es r
unfoldr :: e <: es => (s -> Eff es (Either r (a, s))) -> s -> Proxy x1 x () a e -> Eff es r
mapM_ :: e <: es => (a -> Eff es ()) -> Proxy () a b b' e -> Eff es r
drain :: e <: es => Proxy () b c' c e -> Eff es r
map :: e <: es => (a -> b) -> Pipe a b e -> Eff es r
mapM :: e <: es => (a -> Eff es b) -> Pipe a b e -> Eff es r
takeWhile' :: e <: es => (r -> Bool) -> Pipe r r e -> Eff es r
stdinLn :: (e1 <: es, e2 <: es) => IOE e1 -> Producer String e2 -> Eff es r
stdoutLn :: (e1 <: es, e2 <: es) => IOE e1 -> Consumer String e2 -> Eff es r

module Bluefin.Internal.GadtEffect

-- | Bring a <a>Send</a> into scope with <a>interpret</a>.
newtype Send f e
MkSend :: EffectHandler f e -> Send f e

-- | A convenient type synoynm matching <a><tt>effectful</tt></a> and
--   <a><tt>polysemy</tt></a>'s usages provided for people who are
--   migrating from those libraries.
type Effect = (Type -> Type) -> Type -> Type

-- | Send a primitive operation to the handler for interpretation. This is
--   the Bluefin analog of <tt>effectful</tt>'s <a><tt>send</tt></a> and
--   <tt>polysemy</tt>'s <a><tt>send</tt></a>.
send :: e1 <: es => Send f e1 -> f (Eff es) r -> Eff es r

-- | A convenient type synonym. This is like <tt>effectful</tt>'s
--   <a><tt>EffectHandler</tt></a>. A similar type also appears in
--   <tt>polysemy</tt> as the argument to functions like
--   <a><tt>intercept</tt></a>.
type EffectHandler f es = forall e r. f (Eff e) r -> -- | ͘ Eff (e :& es) r

-- | <pre>
--   import System.IO qualified as IO
--   
--   runFileSystem ::
--     forall es e1 e2 r.
--     (e1 &lt;: es, e2 &lt;: es) =&gt;
--     <a>IOE</a> e1 -&gt;
--     <a>Exception</a> <a>IOException</a> e2 -&gt;
--     (forall e. <a>Send</a> FileSystem e -&gt; Eff (e :&amp; es) r) -&gt;
--     Eff es r
--   runFileSystem io ex = <a>interpret</a> $ \case
--     ReadFile path -&gt;
--       adapt (IO.<a>readFile</a> path)
--     WriteFile path contents -&gt;
--       adapt (IO.<a>writeFile</a> path contents)
--     Trace msg body -&gt; do
--       <a>effIO</a> io (putStrLn ("Start: " &lt;&gt; msg))
--       r &lt;- <a>useImpl</a> body
--       effIO io (putStrLn ("End: " &lt;&gt; msg))
--       pure r
--     where
--       -- If you don't want to write this signature you can use
--       -- {-# LANGUAGE NoMonoLocalBinds #-}
--       adapt :: (e1 &lt;: es', e2 &lt;: es') =&gt; IO r' -&gt; Eff es' r'
--       adapt m = <a>rethrowIO</a> io ex (effIO io m)
--   </pre>
interpret :: EffectHandler f es -> (forall e. Send f e -> Eff (e :& es) r) -> Eff es r
newtype GadtEffect f a e
MkGadtEffect :: f (Eff e) a -> GadtEffect f a e
[unGadtEffect] :: GadtEffect f a e -> f (Eff e) a
mapGadtEffect :: (f1 (Eff e1) r1 -> f2 (Eff e2) r2) -> GadtEffect f1 r1 e1 -> GadtEffect f2 r2 e2

-- | <pre>
--   instance
--     (e &lt;: es) =&gt;
--     <a>OneWayCoercible</a> (<a>GadtEffect</a> FileSystem r e) (GadtEffect FileSystem r es)
--     where
--     <a>oneWayCoercibleImpl</a> = <a>oneWayCoercibleGadtEffectTrustMe</a> $ \case
--       ReadFile path -&gt; ReadFile path
--       WriteFile path contents -&gt; WriteFile path contents
--       Trace msg body -&gt; Trace msg (useImpl body)
--   </pre>
oneWayCoercibleGadtEffectTrustMe :: e <: es => (forall e' es'. e' <: es' => f (Eff e') r -> f (Eff es') r) -> OneWayCoercibleD (GadtEffect f r e) (GadtEffect f r es)

-- | Version of <a>send</a> for use when pattern matching in
--   <a>interpose</a>
--   
--   <pre>
--   augmentOp2Interpose ::
--     (e1 &lt;: es, e2 &lt;: es) =&gt;
--     IOE e2 -&gt;
--     <a>HandleReader</a> (Send E) e1 -&gt;
--     Eff es r -&gt;
--     Eff es r
--   augmentOp2Interpose io = <a>interpose</a> $ \fc -&gt; \case
--     Op2 -&gt; effIO io (putStrLn "augmented op2") &gt;&gt; send fc Op2
--     op -&gt; <a>passthrough</a> fc op
--   </pre>
passthrough :: (Handle (GadtEffect f r), e1 <: es, e2 <: es) => Send f e1 -> f (Eff e2) r -> Eff es r

-- | <pre>
--   augmentOp2Interpose ::
--     (e1 &lt;: es, e2 &lt;: es) =&gt;
--     IOE e2 -&gt;
--     <a>HandleReader</a> (Send E) e1 -&gt;
--     Eff es r -&gt;
--     Eff es r
--   augmentOp2Interpose io = <a>interpose</a> $ \fc -&gt; \case
--     Op2 -&gt; effIO io (putStrLn "augmented op2") &gt;&gt; send fc Op2
--     op -&gt; <a>passthrough</a> fc op
--   </pre>
interpose :: e1 <: es => (Send f es -> EffectHandler f es) -> HandleReader (Send f) e1 -> Eff es r -> Eff es r
instance Bluefin.Internal.Handle (Bluefin.Internal.GadtEffect.Send f)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.GadtEffect.Send f e) (Bluefin.Internal.GadtEffect.Send f es)

module Bluefin.Internal.Examples
example :: ()

module Bluefin.Internal.DslBuilderEffects
newtype DslBuilderEffects h es r
MkDslBuilderEffects :: (forall e. h e -> Eff (e :& es) r) -> DslBuilderEffects h es r
[unMkDslBuilderEffects] :: DslBuilderEffects h es r -> forall e. h e -> Eff (e :& es) r
useImplDslBuilderEffects :: e <: es => DslBuilderEffects h e r -> DslBuilderEffects h es r
runDslBuilderEffects :: h es -> DslBuilderEffects h es r -> Eff es r
dslBuilderEffects :: (forall e. h e -> Eff (e :& es) r) -> DslBuilderEffects h es r
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.DslBuilderEffects.DslBuilderEffects h e r) (Bluefin.Internal.DslBuilderEffects.DslBuilderEffects h es r)
instance Bluefin.Internal.Handle h => GHC.Base.Functor (Bluefin.Internal.DslBuilderEffects.DslBuilderEffects h es)
instance Bluefin.Internal.Handle h => GHC.Base.Applicative (Bluefin.Internal.DslBuilderEffects.DslBuilderEffects h es)
instance Bluefin.Internal.Handle h => GHC.Base.Monad (Bluefin.Internal.DslBuilderEffects.DslBuilderEffects h es)

module Bluefin.Internal.DslBuilderEff
newtype DslBuilderEff h es r
MkDslBuilderEff :: (forall e. h e -> Eff (e :& es) r) -> DslBuilderEff h es r
[unMkDslBuilderEff] :: DslBuilderEff h es r -> forall e. h e -> Eff (e :& es) r
useImplDslBuilderEff :: e <: es => DslBuilderEff h e r -> DslBuilderEff h es r
runDslBuilderEff :: h es -> DslBuilderEff h es r -> Eff es r
dslBuilderEff :: (forall e. h e -> Eff (e :& es) r) -> DslBuilderEff h es r
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.DslBuilderEff.DslBuilderEff h e r) (Bluefin.Internal.DslBuilderEff.DslBuilderEff h es r)
instance Bluefin.Internal.Handle h => GHC.Base.Functor (Bluefin.Internal.DslBuilderEff.DslBuilderEff h es)
instance Bluefin.Internal.Handle h => GHC.Base.Applicative (Bluefin.Internal.DslBuilderEff.DslBuilderEff h es)
instance Bluefin.Internal.Handle h => GHC.Base.Monad (Bluefin.Internal.DslBuilderEff.DslBuilderEff h es)

module Bluefin.Internal.DslBuilder
newtype Forall f r
MkForall :: (forall es. f es r) -> Forall f r
[unForall] :: Forall f r -> forall es. f es r
mkForall :: (forall es. f es r) -> Forall f r
newtype DslBuilder h r
MkDslBuilder :: Forall (DslBuilderEffects h) r -> DslBuilder h r
[unMkDslBuilder] :: DslBuilder h r -> Forall (DslBuilderEffects h) r
runDslBuilder :: Handle h => h es -> DslBuilder h r -> Eff es r
dslBuilder :: (forall e. h e -> Eff e r) -> DslBuilder h r
instance Bluefin.Internal.Handle h => GHC.Base.Functor (Bluefin.Internal.DslBuilder.DslBuilder h)
instance Bluefin.Internal.Handle h => GHC.Base.Applicative (Bluefin.Internal.DslBuilder.DslBuilder h)
instance Bluefin.Internal.Handle h => GHC.Base.Monad (Bluefin.Internal.DslBuilder.DslBuilder h)
instance forall k (f :: k -> * -> *). (forall (es :: k). GHC.Base.Functor (f es)) => GHC.Base.Functor (Bluefin.Internal.DslBuilder.Forall f)
instance forall k (f :: k -> * -> *). (forall (es :: k). GHC.Base.Applicative (f es)) => GHC.Base.Applicative (Bluefin.Internal.DslBuilder.Forall f)
instance forall k (f :: k -> * -> *). (forall (es :: k). GHC.Base.Monad (f es)) => GHC.Base.Monad (Bluefin.Internal.DslBuilder.Forall f)

module Bluefin.Internal.CloneableHandle

-- | You can define a <tt>CloneableHandle</tt> instance for your
--   <tt>Handle</tt> as long as it is a product type of
--   <tt>CloneableHandle</tt>s. To define the instance, use
--   <tt>DerivingVia</tt> and <a>GenericCloneableHandle</a>. For example:
--   
--   <pre>
--   data MyHandle e = MkMyHandle (<a>Exception</a> String e) (<a>State</a> Int e)
--     deriving (<a>Generic</a>, <a>Generic1</a>)
--     deriving (<a>Handle</a>) via <a>OneWayCoercibleHandle</a> MyHandle
--     deriving (<a>CloneableHandle</a>) via <a>GenericCloneableHandle</a> MyHandle
--   
--   instance (e <a>&lt;:</a> es) =&gt; <a>OneWayCoercible</a> (MyHandle e) (MyHandle es) where
--     <a>oneWayCoercibleImpl</a> = <a>gOneWayCoercible</a>
--   </pre>
class (Handle h) => CloneableHandle h

-- | Blah
cloneableHandleImpl :: CloneableHandle h => CloneableHandleD h
newtype ( h1 :~> h2 ) es
MkArrow :: (forall e. h1 e -> h2 (e :& es)) -> (:~>) h1 h2 es
infixr 9 :~>
newtype HandleCloner h1 h2 es
MkHandleCloner :: (forall r. h1 es -> (forall e. h2 e -> Eff (e :& es) r) -> Eff es r) -> HandleCloner h1 h2 es

-- | You can use <tt>DerivingVia</tt> with <tt>GenericCloneableHandle</tt>
--   to derive a <a>CloneableHandle</a> instance for your type, as long as
--   it is a product type of <tt>CloneableHandle</tt>s.
newtype GenericCloneableHandle h e
MkGenericCloneableHandle :: h e -> GenericCloneableHandle h e

-- | <tt>Generic</tt> implementation detail of
--   <a>GenericCloneableHandle</a>. Bluefin users should never need to use
--   this directly.
class (Handle h) => GCloneableHandle h
gCloneableHandleImpl :: GCloneableHandle h => CloneableHandleD h
newtype CloneableHandleD h
MkCloneableHandleD :: (forall e. HandleCloner h h e) -> CloneableHandleD h
withEffToIOCloneHandle :: (e1 <: es, CloneableHandle h) => IOE e1 -> h es -> ((forall r. (forall e. IOE e -> h e -> Eff e r) -> IO r) -> IO a) -> Eff es a
app :: Handle h2 => (h1 :~> h2) e -> h1 e -> h2 e
cloneHandleClass :: (e1 <: es, CloneableHandle h) => h e1 -> (forall e. h e -> Eff (e :& es) r) -> Eff es r
cloneHandle2 :: (Handle h1, Handle h2, e1 <: es) => HandleCloner h1 h2 es -> h1 e1 -> (forall e. h2 e -> Eff (e :& es) r) -> Eff es r
hcIOE :: HandleCloner IOE IOE e
hcState :: HandleCloner (State s) (State s) e
hcException :: HandleCloner (Exception ex) (Exception ex) e
hcReader :: HandleCloner (Reader r) (Reader r) e
hcHandleReader :: CloneableHandle h => HandleCloner (HandleReader h) (HandleReader h) e
abstract :: Handle h2 => (forall e. h1 e -> h2 (e :& es)) -> (h1 :~> h2) es
lmapHC :: (Handle h, Handle h2) => (h1 :~> h2) e -> HandleCloner h2 h e -> HandleCloner h1 h e
pureHC :: h2 e -> HandleCloner h1 h2 e
fmapHC :: (Handle h, Handle h1, Handle h2) => (h1 :~> h2) e -> HandleCloner h h1 e -> HandleCloner h h2 e
apHC :: (Handle h, Handle h1, Handle h2) => HandleCloner h (h1 :~> h2) e -> HandleCloner h h1 e -> HandleCloner h h2 e
infixl 9 `apHC`
liftHC2 :: forall h h1 h2 hr es. (Handle h, Handle h1, Handle h2) => (forall e. h1 e -> h2 e -> hr e) -> HandleCloner h h1 es -> HandleCloner h h2 es -> HandleCloner h hr es
gCloneableHandle :: forall h. (Handle h, Generic1 h) => GCloneableHandle (Rep1 h) => CloneableHandleD h
getHandleCloner :: GCloneableHandle h => HandleCloner h h e
class MonadIO m => MonadUnliftIO (m :: Type -> Type)
withRunInIO :: MonadUnliftIO m => ((forall a. () => m a -> IO a) -> IO b) -> m b
class Monad m => MonadIO (m :: Type -> Type)
liftIO :: MonadIO m => IO a -> m a
class () => Generic1 (f :: k -> Type)
instance Bluefin.Internal.Handle h => Bluefin.Internal.Handle (Bluefin.Internal.CloneableHandle.GenericCloneableHandle h)
instance (Bluefin.Internal.Handle h, GHC.Generics.Generic1 h, Bluefin.Internal.CloneableHandle.GCloneableHandle (GHC.Generics.Rep1 h)) => Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.CloneableHandle.GenericCloneableHandle h)
instance Bluefin.Internal.CloneableHandle.CloneableHandle h => Bluefin.Internal.CloneableHandle.GCloneableHandle (GHC.Generics.Rec1 h)
instance Bluefin.Internal.CloneableHandle.GCloneableHandle h => Bluefin.Internal.CloneableHandle.GCloneableHandle (GHC.Generics.M1 i t h)
instance (Bluefin.Internal.CloneableHandle.GCloneableHandle h1, Bluefin.Internal.CloneableHandle.GCloneableHandle h2) => Bluefin.Internal.CloneableHandle.GCloneableHandle (h1 GHC.Generics.:*: h2)
instance Bluefin.Internal.CloneableHandle.CloneableHandle Bluefin.Internal.IOE
instance Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.State s)
instance Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.Exception a)
instance Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.Reader r)
instance Bluefin.Internal.CloneableHandle.CloneableHandle h => Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.HandleReader h)
instance (TypeError ...) => Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.Coroutine a b)
instance (TypeError ...) => Bluefin.Internal.CloneableHandle.CloneableHandle (Bluefin.Internal.Writer w)
instance (Bluefin.Internal.Handle h, e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.CloneableHandle.GenericCloneableHandle h e) (Bluefin.Internal.CloneableHandle.GenericCloneableHandle h es)
instance (Bluefin.Internal.Handle h1, Bluefin.Internal.Handle h2) => Bluefin.Internal.Handle (h1 Bluefin.Internal.CloneableHandle.:~> h2)
instance (Bluefin.Internal.Handle h1, Bluefin.Internal.Handle h2, e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible ((Bluefin.Internal.CloneableHandle.:~>) h1 h2 e) ((Bluefin.Internal.CloneableHandle.:~>) h1 h2 es)
instance (Bluefin.Internal.Handle h1, Bluefin.Internal.Handle h2) => Bluefin.Internal.Handle (Bluefin.Internal.CloneableHandle.HandleCloner h1 h2)
instance (Bluefin.Internal.Handle h1, Bluefin.Internal.Handle h2) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.CloneableHandle.HandleCloner h1 h2 e) (Bluefin.Internal.CloneableHandle.HandleCloner h1 h2 es)

module Bluefin.Internal.Exception
data HandledKey ret
MkHandledKey :: !Exception ex -> (ex -> ret) -> HandledKey ret
checkHandledKey :: HandledKey ret -> InFlight -> Maybe ret
runBodyWithHandlers :: ([HandledKey (r -> Eff es a)], BracketBase b r a es) -> Eff es a

-- | To create a <tt>MakeExceptions</tt> use <a>catchWithResource</a> and
--   the <tt>Applicative</tt>-like functions that produce and combine them.
newtype MakeExceptions r a h es
MkMakeExceptions :: Eff es (HandlerUnwrapped r a h es) -> MakeExceptions r a h es
data HandlerUnwrapped r a h es
MkHandlerUnwrapped :: [HandledKey (r -> Eff es a)] -> (forall b. (forall e. h e -> Eff (e :& es) b) -> Eff es b) -> HandlerUnwrapped r a h es
pureHandlerUnwrapped :: h e -> HandlerUnwrapped r a h e

-- | Analogous to <a>pure</a>
pureMakeExceptions :: h e -> MakeExceptions r a h e
apHandlerUnwrapped :: (Handle h1, Handle h2) => HandlerUnwrapped r a (h1 :~> h2) e -> HandlerUnwrapped r a h1 e -> HandlerUnwrapped r a h2 e

-- | Analogous to <a>ap</a> and <a>&lt;*&gt;</a>
apMakeExceptions :: (Handle h1, Handle h2) => MakeExceptions r a (h1 :~> h2) e -> MakeExceptions r a h1 e -> MakeExceptions r a h2 e
fmapHandlerUnwrapped :: (Handle h1, Handle h2) => (h1 :~> h2) e -> HandlerUnwrapped r a h1 e -> HandlerUnwrapped r a h2 e

-- | Analogous to <a>fmap</a> and <a>&lt;$&gt;</a>
fmapMakeExceptions :: (Handle h1, Handle h2) => (h1 :~> h2) e -> MakeExceptions r a h1 e -> MakeExceptions r a h2 e
catchWithResource :: forall ex r a es. (r -> ex -> Eff es a) -> MakeExceptions r a (Exception ex) es

-- | A generalization of <tt>bracket</tt> that enables distinguishing
--   exceptional from normal exit.
--   
--   <ul>
--   <li><i><tt>r</tt></i> The type of the resource</li>
--   <li><i><tt>b</tt></i> The result type of the body</li>
--   <li><i><tt>a</tt></i> The type of the overall result</li>
--   <li><i><tt>h</tt></i> The handle of exceptions available in the
--   body</li>
--   </ul>
generalBracket :: forall r b h a es. Handle h => Eff es r -> MakeExceptions r a h es -> (r -> b -> Eff es a) -> (r -> Eff es ()) -> (forall e. h e -> r -> Eff (e :& es) b) -> Eff es a
data BracketBase bodyRes r a es
MkBracketBase :: !Eff es r -> !r -> bodyRes -> Eff es a -> !r -> Eff es () -> !r -> Eff es bodyRes -> BracketBase bodyRes r a es

-- | Acquire the resource
--   
--   This is run inside an asynchronous exception <a>mask</a>.
[$sel:acquire:MkBracketBase] :: BracketBase bodyRes r a es -> !Eff es r

-- | Release the resource after normal exit
--   
--   This is run inside an asynchronous exception <a>mask</a>.
[$sel:normalRelease:MkBracketBase] :: BracketBase bodyRes r a es -> !r -> bodyRes -> Eff es a

-- | Release the resource after exit due to an unknown exception.
--   
--   The exception will continue to be raised after this.
--   
--   This is run inside an asynchronous exception <a>mask</a>.
[$sel:unknownExceptionRelease:MkBracketBase] :: BracketBase bodyRes r a es -> !r -> Eff es ()

-- | Use the resource
[$sel:body:MkBracketBase] :: BracketBase bodyRes r a es -> !r -> Eff es bodyRes
useImplBracketBase :: e <: es => BracketBase b r a e -> BracketBase b r a es
instance Bluefin.Internal.Handle h => Bluefin.Internal.Handle (Bluefin.Internal.Exception.HandlerUnwrapped r a h)
instance Bluefin.Internal.Handle h => Bluefin.Internal.Handle (Bluefin.Internal.Exception.MakeExceptions r a h)
instance GHC.Generics.Generic (Bluefin.Internal.Exception.BracketBase bodyRes r a es)
instance (e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Exception.BracketBase bodyRes r a e) (Bluefin.Internal.Exception.BracketBase bodyRes r a es)
instance (Bluefin.Internal.Handle h, e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Exception.MakeExceptions r a h e) (Bluefin.Internal.Exception.MakeExceptions r a h es)
instance (Bluefin.Internal.Handle h, e Bluefin.Internal.<: es) => Bluefin.Internal.OneWayCoercible.OneWayCoercible (Bluefin.Internal.Exception.HandlerUnwrapped r a h e) (Bluefin.Internal.Exception.HandlerUnwrapped r a h es)
instance GHC.Base.Functor Bluefin.Internal.Exception.HandledKey
