foldable flexible bridges (putting foldable+traversable in prelude) Re: Burning bridges

Erik Hesselink hesselink at gmail.com
Tue May 21 14:56:32 CEST 2013


On Tue, May 21, 2013 at 12:26 PM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
> On Tue, 21 May 2013, Carter Schonwald wrote:
>
>> thats a wonderfully easy breakage, an eminently patchable one even. There
>> will no doubt be much patching of
>> many actively maintained libs around ghc 7.8's release anyways, so why not
>> amortize that effort to improve
>> prelude while we're at it? Thats a great time to improve things.
>
> I still don't see, why Data.Foldable is less standard than Prelude. Both are
> in 'base'. The difference is just, that you have to import the first one and
> not the other one. If this is too much effort - why can't you teach your
> smart beginners using one of the alternative prelude projects?

Then you've never done this, at least not in combination with the mtl.
You need at least two imports to import the generalized mapM_ etc:

import Prelude hiding (mapM_)
import Data.Foldable (mapM_)

With mtl (one of the most used packages in the Haskell ecosystem, I'd
guess) you additionally need:

import Control.Monad.State hiding (mapM_)
import Control.Monad.Reader hiding (mapM_)

Etcetera etcetera. It's definitely not impossible, but it's a lot
harder than 'just, that you import the first one and not the other'.
Another difficulty is that if you make an 'alternative prelude'
including the generalized mapM_ etc, you have to use
NoImplicitPrelude, whereas if your alternative prelude is just an
addition, you can just import it.

These are all small things, but they add up if you do day to day
Haskell programming.

Erik



More information about the Libraries mailing list