I realized it's possible to write
SeqT q >>= f = SeqT $ fmap {- a bunch of gunk -} q
This automatically takes care of making >>= entirely strict in its first argument for strict monad lawfulness as mentioned in #34. Is it a good thing or a bad thing otherwise? Clearly any rewrite rules might need to be adjusted to accommodate it.
One potentially nifty thing: (s >>= f) >>= g becomes, essentially, fmap (gunk g) (fmap (gunk f) s), making it subject to an fmap/fmap fusion law we could write for Queue.
I realized it's possible to write
This automatically takes care of making
>>=entirely strict in its first argument for strict monad lawfulness as mentioned in #34. Is it a good thing or a bad thing otherwise? Clearly any rewrite rules might need to be adjusted to accommodate it.One potentially nifty thing:
(s >>= f) >>= gbecomes, essentially,fmap (gunk g) (fmap (gunk f) s), making it subject to anfmap/fmapfusion law we could write forQueue.