atom feed18 messages in org.haskell.librariesMoving basic functions
FromSent OnAttachments
David LuposchainskyMar 13, 2013 2:58 am 
Henning ThielemannMar 13, 2013 3:21 am 
Johan TibellMar 13, 2013 8:39 am 
David LuposchainskyMar 13, 2013 8:54 am 
David LuposchainskyApr 3, 2013 1:11 am 
Roman CheplyakaApr 3, 2013 2:26 am 
Herbert Valerio RiedelApr 3, 2013 3:31 am 
Roman CheplyakaApr 3, 2013 3:38 am 
Herbert Valerio RiedelApr 3, 2013 3:46 am 
Edward KmettApr 3, 2013 6:46 am 
David LuposchainskyApr 3, 2013 9:26 am 
Evan LaforgeApr 3, 2013 10:37 am 
Edward KmettApr 3, 2013 11:16 am 
David LuposchainskyApr 4, 2013 8:06 am 
Edward A KmettApr 4, 2013 8:13 am 
David LuposchainskyApr 6, 2013 9:36 am 
Evan LaforgeApr 6, 2013 9:51 am 
Edward KmettApr 6, 2013 7:26 pm 
Subject:Moving basic functions
From:David Luposchainsky (
Date:Mar 13, 2013 2:58:41 am

Hello GHC HQ, hello mailing list,

there are a couple of basic functions that I think aren't where they should be.

1. void is currently in Control.Monad. However, it is defined only in terms of fmap (and therefore only has a Functor constraint). Although this function is often used in a monadic setting as ">> return ()", I really don't think Control.Monad is the right place for it.

2. a) swap is the only function from Data.Tuple that is not exported to Prelude. On #haskell, people are sometimes even surprised there /is/ a Data.Tuple, and redefine their own version of swap at need. I therefore suggest including Data.Tuple.swap in the Prelude.

The obvious downside of this change would of course be that it breaks code if there is a top-level user-defined version of it. Fixing this is of course trivial, but necessary.

b) A related suggestion would be the addition of an irrefutable swap, (swap'?), defined as "swap ~(a,b) = (b,a)", and its addition to Prelude for the same reasons.

3. $>, a flipped version of <$, currently resides in Control.Comonad, but should be in Data.Functor. Applicative has <* and *>, Monad has >>= and =<<, and I personally keep redefining (or specifically importing) $> quite often, and I don't think I'm the only one.

As these are quite small changes I think 2 weeks should be a sufficiently long discussion period.

Greetings, David