bluefin-0.10.1.0: The Bluefin effect system
Safe HaskellNone
LanguageHaskell2010

Bluefin.Capability.Tell

Synopsis

Documentation

In most cases you'll probably prefer Yield to Tell, but Tell can still be useful in some cases, for example with Data.Monoid.Any to determine whether an event ever occurred.

Capability

data Tell w (e :: Effects) #

Instances

Instances details
e <: es => OneWayCoercible (Tell w e :: Type) (Tell w es :: Type) 
Instance details

Defined in Bluefin.Internal

Handle (Tell w) 
Instance details

Defined in Bluefin.Internal

Methods

handleImpl :: HandleD (Tell w) #

(TypeError ('Text "Tell cannot be cloned. Perhaps you want an STM channel?") :: Constraint) => CloneableHandle (Tell w) 
Instance details

Defined in Bluefin.Internal.CloneableHandle

Handlers

runTell #

Arguments

:: forall w (es :: Effects) r. Monoid w 
=> (forall (e :: Effects). Tell w e -> Eff (e :& es) r)

͘

-> Eff es (r, w) 
>>> getAny $ snd $ runPureEff $ runTell $ \w -> do
      -- Non-empty list (the tell event does happen)
      for_ [1 .. 10] $ \_ -> tell w (Any True)
True

execTell #

Arguments

:: forall w (es :: Effects) r. Monoid w 
=> (forall (e :: Effects). Tell w e -> Eff (e :& es) r)

͘

-> Eff es w 
>>> getAny $ runPureEff $ execTell $ \w -> do
      -- Non-empty list (the tell event does happen)
      for_ [1 .. 10] $ \_ -> tell w (Any True)
True
>>> getAny $ runPureEff $ execTell $ \w -> do
      -- Empty list (the tell event does not happen)
      for_ [] $ \_ -> tell w (Any True)
False

Effectful operations

tell #

Arguments

:: forall (e :: Effects) (es :: Effects) w. e <: es 
=> Tell w e 
-> w

͘

-> Eff es () 
>>> getAny $ runPureEff $ execWriter $ \w -> do
      -- Non-empty list (the tell event does happen)
      for_ [1 .. 10] $ \_ -> tell w (Any True)
True