fused-effects v1.0.0.0 Release Notes
Release Date: 2019-11-11 // over 4 years ago-
➕ Adds an
Empty
effect, modelling nondeterminism without choice (#196).➕ Adds an
EmptyC
carrier forEmpty
. (#196)➕ Adds a
Choose
effect, modelling nondeterminism without failure (#198).➕ Adds a
Throw
effect, modelling failure with a value. (#247)➕ Adds a
Catch
effect which can be used withThrow
(or other kinds of failure) to model recoverable failure. (#247)➕ Adds a
oneOf
function toControl.Effect.NonDet
to provide an idiom for the common case of nondeterministically selecting from a container. (#201)➕ Adds a
foldMapA
function toControl.Effect.NonDet
mapping containers into nondeterministic computations using a supplied function. (#204)Defines a new
Has
constraint synonym, conveniently combiningCarrier
andMember
constraints and used for all effect constructors. (#217)👍 Allows effects to be defined and handled as sums of other effects, while still using the constructors for the component effects. This has been used to redefine
NonDet
as a sum ofEmpty
andChoose
, andError
as a sum ofThrow
andCatch
. (#199, #219, #247)Defines
Carrier
instances for a number of types inbase
, includingEither
,Maybe
,[]
, andIO
. (#206)Defines
Carrier
instances for a number of types intransformers
. (#226)Defines an
evalFresh
handler forControl.Carrier.Strict.FreshC
, taking the initial value. (#267)
Backwards-incompatible changes
💅 Renames the
Carrier
class toAlgebra
and itseff
method toalg
, and moved the responsibilities ofControl.Carrier
toControl.Algebra
. This makes the library more consistent with the literature and encourages a style of naming that focuses on morphisms rather than objects. (#285, #294)🛠 Fixes unlawful behaviour in the
Applicative
instance forErrorC
, which had different behaviour between<*>
andap
in the presence of a divergent rhs. In order to accomplish this,ErrorC
has been defined as a wrapper aroundControl.Monad.Trans.Except.ExceptT
. (#228)👌 Improves the performance of
runInterpret
using reflection, changing its signature slightly (#193, h/t @ocharles).✂ Removes
Control.Effect.Random
(and the dependencies onrandom
&MonadRandom
) in favour of a newfused-effects-random
package (#200).✂ Removes
fmap'
andhandlePure
, both deprecated in 0.5.0.0 (#205).Redefines
NonDetC
as a Church-encoded binary tree instead of a Church-encoded list (#197).✂ Removes the
OnceC
carrier forCull
effects, replacing it with the composition ofCullC
on some otherAlternative
carrier, e.g.NonDetC
(#204).🚚 Moves all the carriers into their own modules in the
Control.Carrier
namespace. Several have also been renamed, e.g. the variousTrace
carriers are all namedTraceC
within their separate modules, and should be imported qualified if disambiguation is required. This simplifies naming schemes, and ensures that the choice of e.g. strict or lazy carrier is always made consciously and expliclty, instead of defaulting to whichever is exported by the effect module (#204).✂ Removes the re-export of
Member
from all carrier modules, re-exportingHas
in its place.Has
constraints should generally be used instead, and specialist cases can importControl.Effect.Sum
forMember
. (#217)Redesigns & renames the handlers for church-encoded nondeterminism carriers to standardize naming and usage patterns. (#207)
- The primary handlers (
runChoose
,runNonDet
,runCut
,runCull
) take multiple continuations. - Handlers which return an
Alternative
are suffixed withA
, e.g.runNonDetA
. - Handlers which return a
Monoid
are suffixed withM
, e.g.runNonDetM
. - Handlers which return a
Semigroup
are suffixed withS
, e.g.runChooseS
.
- The primary handlers (
✂ Removes
InterposeC
&runInterpose
due to their inefficiency. They can be replaced with use ofInterpretC
/runInterpret
for the desired effect. (#223)✂ Removes
prj
fromMember
, as it was only used inInterposeC
(see above), and was generally inadvisable due to its lack of modularity. (#223)✂ Removes the
Resource
effect and carrier. Both have been relocated tofused-effects-exceptions
. (#268)Redefines
Fail
as a synonym forThrow String
. (#247)✂ Removes
Resumable
and its carriers. Both have been relocated tofused-effects-resumable
; they can also be usefully and flexibly replaced by arbitrary effects,Lift
, andInterpretC
. (#269)🔄 Changes
Control.Carrier.Fresh.Strict.runFresh
to take and return the initial & final values, respectively, allowing for safer operation. (#267)Removes
resetFresh
, as it was unsafe. Greater safety and control over the generation of fresh values can be obtained by use ofrunFresh
. (#267)✂ Removes
PureC
;Data.Functor.Identity.Identity
should be used instead. Note thatrun
is still provided as a convenient synonym forrunIdentity
. (#307)✂ Removes the
Pure
effect. It’s unlikely that this will require changes, asPure
had no operations, butLift Identity
should be used instead. (#307)👻 Redefines the
Lift
effect, allowing inner contexts to run actions in outer contexts, e.g. to interoperate withControl.Exception
. (#306)✂ Removes
MonadUnliftIO
instances as they’ve been subsumed by the new definition ofLift
. Additionally, theReaderT
&IdentityT
types defined intransformers
may be useful. (#306)