Proposal: Use (.) and id from Control.Category in Prelude

Erik Hesselink hesselink at gmail.com
Mon Jun 16 09:09:06 UTC 2014


On Sun, Jun 15, 2014 at 4:13 PM, Herbert Valerio Riedel <hvr at gnu.org> wrote:

> I wonder if Haskell could be extended to be able to write something like
>
>   import Data.Category
>
> and have the more general versions of (.) and id automatically shadow
> the monomorphic versions brought in scope by the Prelude.

We use a custom prelude that almost gives us this. You have to do:

{-# LANGUAGE NoImplicitPrelude #-}

import Prelude.Polymorphic

This gives us Foldable/Traversable/Category polymorphic variants of
the prelude functions. It's been a pretty good experience. The largest
problem, as Edward already mentioned, are the re-exports of
Control.Monad from the mtl package.

I'm -1 on making (.) polymorphic by default though. The errors can be
kind of intimidating for the beginning Haskeller. Let's first see how
it goes with Foldable/Traversable in the prelude...

Erik


More information about the Libraries mailing list