Proposal: Add a strict version of <$> for monads

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Fri Nov 29 12:44:09 UTC 2013


On Fri, Nov 29, 2013 at 01:32:48PM +0100, David Luposchainsky wrote:
> On 29.11.2013 13:19, Twan van Laarhoven wrote:
> > In the same vein as strict fmap, does a strict (<*>) make sense as well?
> 
> I think this brings up a good point: strictness annotations may make
> sense in multiple other scenarios, not just for fmap. Can't we
> encapsulate similar functionality in a separate function first, wait for
> it to settle, and then introduce infix versions of it if really necessary?
> 
> What about
> 
>     seqM :: Monad m => m a -> m a
>     seqM m = m >>= (return $!)

I think this is an excellent idea.  It makes sense to address the issue in
the simplest, most generic way possible first and then later provide
specialised functions when they have been shown to have widespread
real-world usage.

Tom

(PS I note this is yet another example of the invisible Thunk type
constructor causing problems!)


More information about the Libraries mailing list