type Semigroup s = { Monoid s with mappend :: s -> s -> s | _ }
type Pointed f = { Applicative f with pure :: forall a. a -> f a | _ }
type Apply f = { Applicative f with (<*>) :: forall a b. f (a -> b) -> f a -> f b | _ }
type Bind m = { Monad m with (>>=) :: forall a b. m a -> (a -> m b) -> m b | _ }
https://youtu.be/YTaNkWjd-ac?t=3604 Edward wants to split MonadReader
and MonadWriter
up into algebraic (ask
+ tell
) and non-algebraic.. Edward describes a painful change he's putting off, this on the other hand is fine
type AlgMonadReader r m = { MonadReader r m with ask :: m r | _ }
type AlgMonadWriter w m = { MonadWriter r m with tell :: w -> m () | _ }
Here is a PureScript ticket created by Kmett (purescript/purescript-transformers#63) that proposes this
More info: http://comonad.com/reader/2011/monads-from-comonads/
Sadly this breaks down a little for Writer and Reader as the mtl unfortunately has historically included a bunch of extra baggage in these classes. In particular, in reader, the notion of local isn't always available, blocking some otherwise perfectly good MonadReader instances, and I've chosen not to repeat this mistake in comonad-transformers.
I don't know which is the better formulation...
or
or taking it completely by label (+ type? namespaced? who knows)