Proposal: Foldable typeclass: make foldl' and foldr' class methods

Antoine Latter aslatter at gmail.com
Mon Jun 20 20:21:49 CEST 2011


On Mon, Jun 20, 2011 at 12:02 PM, Duncan Coutts
<duncan.coutts at googlemail.com> wrote:
>
> This should not break much code. In particular it should not break
> existing type class instance declarations since there is a default
> definition for instances that don't defined the new methods.
>
> The only potential breakage is that foldl' and foldr' are exported via
> Foldable(..) rather than directly. This could affect modules that use
> explicit imports.  (I consider this fact to be a slightly unfortunate
> quirk of the Haskell module system).
>

What would the broken code look like? GHC 6.12 handles:

> import Module (classMethod)

just fine, even when 'classMethod' is exported only via:

> module Module (MyClass(..))

I haven't tested this too extensively - only with 'runghc'.

Antoine



More information about the Libraries mailing list