Changelog for fused-effects-1.0.0.1
v1.0.0.1
- Adds passthrough
Algebrainstances forApandAlt, allowing the invocation of effects inside these structures without extraneous constructor applications.
v1.0.0.0
-
Adds an
Emptyeffect, modelling nondeterminism without choice (#196). -
Adds an
EmptyCcarrier forEmpty. (#196) -
Adds a
Chooseeffect, modelling nondeterminism without failure (#198). -
Adds a
Throweffect, modelling failure with a value. (#247) -
Adds a
Catcheffect which can be used withThrow(or other kinds of failure) to model recoverable failure. (#247) -
Adds a
oneOffunction toControl.Effect.NonDetto provide an idiom for the common case of nondeterministically selecting from a container. (#201) -
Adds a
foldMapAfunction toControl.Effect.NonDetmapping containers into nondeterministic computations using a supplied function. (#204) -
Defines a new
Hasconstraint synonym, conveniently combiningCarrierandMemberconstraints 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
NonDetas a sum ofEmptyandChoose, andErroras a sum ofThrowandCatch. (#199, #219, #247) -
Defines
Carrierinstances for a number of types inbase, includingEither,Maybe,[], andIO. (#206) -
Defines
Carrierinstances for a number of types intransformers. (#226) -
Defines an
evalFreshhandler forControl.Carrier.Strict.FreshC, taking the initial value. (#267)
Backwards-incompatible changes
-
Renames the
Carrierclass toAlgebraand itseffmethod toalg, and moved the responsibilities ofControl.CarriertoControl.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
Applicativeinstance forErrorC, which had different behaviour between<*>andapin the presence of a divergent rhs. In order to accomplish this,ErrorChas been defined as a wrapper aroundControl.Monad.Trans.Except.ExceptT. (#228) -
Improves the performance of
runInterpretusing reflection, changing its signature slightly (#193, h/t @ocharles). -
Removes
Control.Effect.Random(and the dependencies onrandom&MonadRandom) in favour of a newfused-effects-randompackage (#200). -
Removes
fmap'andhandlePure, both deprecated in 0.5.0.0 (#205). -
Redefines
NonDetCas a Church-encoded binary tree instead of a Church-encoded list (#197). -
Removes the
OnceCcarrier forCulleffects, replacing it with the composition ofCullCon some otherAlternativecarrier, e.g.NonDetC(#204). -
Moves all the carriers into their own modules in the
Control.Carriernamespace. Several have also been renamed, e.g. the variousTracecarriers are all namedTraceCwithin 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
Memberfrom all carrier modules, re-exportingHasin its place.Hasconstraints should generally be used instead, and specialist cases can importControl.Effect.SumforMember. (#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
Alternativeare suffixed withA, e.g.runNonDetA. - Handlers which return a
Monoidare suffixed withM, e.g.runNonDetM. - Handlers which return a
Semigroupare suffixed withS, e.g.runChooseS.
- The primary handlers (
-
Removes
InterposeC&runInterposedue to their inefficiency. They can be replaced with use ofInterpretC/runInterpretfor the desired effect. (#223) -
Removes
prjfromMember, as it was only used inInterposeC(see above), and was generally inadvisable due to its lack of modularity. (#223) -
Removes the
Resourceeffect and carrier. Both have been relocated tofused-effects-exceptions. (#268) -
Redefines
Failas a synonym forThrow String. (#247) -
Removes
Resumableand 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.runFreshto 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.Identityshould be used instead. Note thatrunis still provided as a convenient synonym forrunIdentity. (#307) -
Removes the
Pureeffect. It’s unlikely that this will require changes, asPurehad no operations, butLift Identityshould be used instead. (#307) -
Redefines the
Lifteffect, allowing inner contexts to run actions in outer contexts, e.g. to interoperate withControl.Exception. (#306) -
Removes
MonadUnliftIOinstances as they’ve been subsumed by the new definition ofLift. Additionally, theReaderT&IdentityTtypes defined intransformersmay be useful. (#306)
v0.5.0.1
- Adds support for ghc 8.8.1.
v0.5.0.0
-
Derives
Generic1instances for all non-existentially-quantified effect datatypes. -
Derives
Foldable&Traversableinstances for:+:. -
Defines
MonadFixinstances for all of the carriers. -
Re-exports
run,:+:, andMemberfromControl.Effect.Carrier, reducing the number of imports needed when defining new effects. -
Re-exports
Carrier,Member, andrunfrom the various effect modules, reducing the number of imports needed when using existing effects.
Backwards-incompatible changes
-
Replaces
runResourcewith an equivalent function that usesMonadUnliftIOto select the correct unlifting function (a lawithResource, which is removed in favor ofrunResource). -
Changes the signature of
efffromsig m (m a) -> m atosig m a -> m a, requiring effects to holdm kin their continuation positions instead of merelyk. This was done in order to improve interoperability with other presentations of higher-order syntax, e.g.bound; syntax used withboundcan now be givenHFunctorandCarrierinstances.To upgrade effects used with previous versions, change any continuations from
ktom k. If no existential type variables appear in the effect, you can deriveGeneric1, and thenceHFunctor&Effectinstances. Otherwise, implement the required instances by hand. Since continuation positions now occur inm,hmapdefinitions will have to apply the higher-order function to these as well. -
Adds
Functorconstraints tohmapandMonadconstraints tohandle, allowing a greater variety of instances to be defined (e.g. for recursively-nested syntax). -
Replaces the default definitions of
hmapandhandlewith derivations based onGeneric1instead ofCoercible. Therefore, first-order effects wishing to derive these instances will requireGeneric1instances, presumably derived using-XDeriveGeneric. -
Moves
sendfromControl.Effect.SumtoControl.Effect.Carrier. Likewise removes the re-export ofsendfromControl.Effect. -
Deprecates
fmap'in favour offmap. -
Deprecates
handlePurein favour ofhmap.
v0.4.0.0
Backwards-incompatible changes
- Removes APIs deprecated in 0.3.0.0, including
Eff,interpret,ret, and thehandle*family of helper functions.
Other changes
- Adds the ability to derive default instances of
HFunctorandEffectfor first-order effects, using the-XDeriveAnyClassextension. - Adds a generic
Interposeeffect that enables arbitrary "eavesdropping" on other effects.
0.3.1.0
- Improved speed of
Reader,State,Writer, andPureeffects by defining and inlining auxiliaryApplicativemethods. - Adds
runInterpret&runInterpretStatehandlers inControl.Effect.Interpretas a convenient way to experiment with effect handlers without defining a new carrier type andCarrierinstance. Such handlers are somewhat less efficient than customCarriers, but allow for a smooth upgrade path when more efficiency is required. - Added
unliftio-coreas a dependency so as to provide a blessed API for unlift-style effects and a solution to the cubic-caller problem.
0.3.0.0
Backwards-incompatible changes
- Adds
Monadas a superclass ofCarrier, obviating the need for a lot of constraints, andMonadinstances for all carrier types. This is a backwards-incompatible change, as any carriers users have defined now requireMonadinstances. Note that in many cases carriers can be composed out of existing carriers and monad transformers, and thus these instances can often be derived using-XGeneralizedNewtypeDeriving. We also recommend compiling with-Wredundant-constraintsas many of these can now be removed. - Replaces
AltCwith a new carrier,NonDetC, based on Ralf Hinze’s work in Deriving Backtracking Monad Transformers. This is a backwards-incompatible change.AltCwas equivalent to theListTmonad transformer, and had the same well-known limitation to commutative monads. Therefore, the elimination ofEffrequired a more durable approach. - Removes
Branch. This is a backwards-incompatible change, but was necessitated by the difficulty of implementing correctApplicative&Monadinstances for carriers which used it. Carriers which were employingBranchinternally should be reimplemented usingNonDetCor a similar approach; seeCutCandCullCfor examples. - Renames
Control.Effect.Void,Void, andVoidCtoControl.Effect.Pure,Pure, andPureCrespectively. This is a backwards-incompatible change for code mentioningVoidC; it should be updated to referencePureCinstead.
Deprecations
Effandinterpret, in favour of computing directly in the carriers. This enables the compiler to perform significant optimizations; see the benchmarks for details. Handlers can simply remove theEffwrapping the carrier type & any use ofinterpret. As above, we also recommend compiling with-Wredundant-constraintsas many of these can now be removed.ret, in favor ofpureorreturn.handleEither,handleReader,handleState,handleSum, andhandleTraversablein favour of composing carrier types directly. Carriers can be composed from other carriers andeffdefined withhandleCoercible; and other definitions can usehandlePure&handledirectly.
All deprecated APIs will be removed in the next release.
Other changes
- Adds a lazy
Statecarrier inControl.Effect.State.Lazy - Rewrites
CutCusing an approach related toNonDetC, with the addition of a continuation to distinguishemptyfromcutfail. - Rewrites
CullCusingListCandReaderC. - Moves
OnceCfromControl.Effect.NonDettoControl.Effect.Cullto avoid cyclic dependencies. - Adds a
runCutAllhandler forCuteffects, returning a collection of all results.
0.2.0.2
- Loosens the bounds on QuickCheck to accommodate 2.x.
0.2.0.1
- Fixes the benchmarks, and builds them in CI to avoid regressing them again.
0.2.0.0
- Adds
listen,listens, andcensoroperations toWriter. - Provides explicit type parameters to
run-style functions inState,Reader,Writer, andError. This is a backwards-incompatible change for clients using these functions in combination with visible type applications. - Adds benchmarks of
WriterC/VoidCwrapped withEffagainst their unwrapped counterparts. - Adds
Functor,Applicative, andMonadinstances forWriterC. - Adds
Functor,Applicative, andMonadinstances forVoidC. - Fixes a space leak with
WriterC. - Removes the
Functorconstraint onasksandgets. - Adds
bracketOnError,finally, andonExceptiontoResource. - Adds
sendMtoLift.
0.1.2.1
- Loosens the bounds on QuickCheck to accommodate 0.12.
0.1.2.0
- Adds support for ghc 8.6.2, courtesy of @jkachmar.
- Adds a
Cuteffect which adds committed choice to nondeterminism. - Adds a
Culleffect which adds pruning to nondeterminism. - Adds an example of using
NonDet,Cut, and a character parser effect to define parsers. - Fixes the table of contents links in the README.
0.1.1.0
- Adds a
runNonDetOncehandler which terminates immediately upon finding a solution.
0.1.0.0
Initial release.