Proposal: merge either into transformers

Ross Paterson R.Paterson at city.ac.uk
Wed Apr 30 00:46:41 UTC 2014


On Mon, Apr 28, 2014 at 07:00:25PM +0300, Michael Snoyman wrote:
> On Mon, Apr 28, 2014 at 4:15 PM, Ross Paterson <R.Paterson at city.ac.uk> wrote:
>     The Applicative and Alternative instances would have different
>     contexts, and there would be no instances for Foldable, Traversable,
>     Eq, Ord, Read or Show.
> 
> If we have deprecation of the module in its entirety on the table,
> I think it's acceptable to consider dropping some instances. However,
> I don't see Eq, Ord, Read, or Show instances for strict WriterT in
> transformers 0.3. Applicative seems like it should be identical in
> behavior to what we have right now. I'm not completely certain, but
> it seems the same is true for Alternative.

I was more concerned with consistency across the interface in the
new version.  Here the Applicative and Alternative instances for the
state-based WriterT would have Monad constraints, while the lazy one
just had Applicative constraints, and the lazy transformer would have Eq,
Ord, Read, or Show instances while the strict one wouldn't.

> Here's the question I'd ask, which I honestly don't know the
> answer to. We have three proposed WriterT implementations: lazy,
> current-strict, and state-strict.  We have two conflicting desires:
> program termination and space savings. We know there are cases where
> lazy allows termination where state-strict does not. We know there
> are cases where state-strict allows space savings where neither lazy
> nor current-strict do.
> 
> The question is: are there cases where current-strict:
> 
> 1. Gives space savings that lazy does not?
> 2. Gives termination where state-strict does not?
> 
> I *think* the answers to these questions are "no" and "yes", meaning that
> current-strict in its current form can *always* be replaced by lazy, without
> losing anything. If that's the case, I'd say this is a very simple transition
> in 0.4.

Of course strictness sometimes means more space, but you may be right on
the termination issue.


More information about the Libraries mailing list