fused-effects / fused-effects

A fast, flexible, fused effect system for Haskell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Several carriers are redundant with transformers

robrix opened this issue · comments

Several of our carriers have been redundant since 1.0, most notably ReaderC is redundant with ReaderT, & strict & lazy StateC are redundant with strict & lazy StateT.

I think we should remove them in 1.1, replacing them with (deprecated) type (and maybe pattern?) synonyms in the relevant modules; I’m good with leaving runReader & runState in place, however, since these have nicer types than e.g. runReaderT & runStateT.

Control.Carrier.Writer.Strict.WriterC could be seen as redundant with Control.Monad.Trans.Writer.CPS, but we’d have to provide an instance for the latter which means a little more -XCPP. However, we already bit that bullet with the addition of the Algebra instance for Ap, so I’m willing to add it to the list.

Edit: this has been done.

We could also just deprecate in situ without removing the instances, which wouldn’t break anything reliant on the constructor but would leave the redundant code in place for at least a major version cycle.

LiftC could be replaced with IdentityT, too.

Either.ErrorC might be a little bit different: it implements Alternative by passing through to the underlying monad instead of requiring a Monoid instance for the error type like ExceptT does. (IMO ExceptT’s instance is deeply regrettable.)

Unfortunately, if we drop WriterC, we’d be leaving ghc 8.2.2 and 8.4.4 without a space-efficient Writer carrier, because Control.Monad.Trans.Writer.CPS was only added in transformers 0.5.6, and ghc 8.4.4 depends on 0.5.5.

commented

Could it conditionally depend on minad/writer-cps-transformers?

Could it conditionally depend on minad/writer-cps-transformers?

Conditionally as in have e.g. if (impl(ghc < 8.6)) in the build-depends field? That’s a good suggestion, thank you.

I’m actually slightly less concerned about it than I had been, tho, because our new Church-encoded carrier seems to be significantly more efficient anyway.

I’ve decided to drop this from 1.1, tho I still think it might be a reasonable option for a future major release (1.2? 1.5? 2.0?).