[Haskell-cafe] >>= definition for list monad in ghc

Felipe Almeida Lessa felipe.lessa at gmail.com
Mon May 16 21:12:07 CEST 2011


On Mon, May 16, 2011 at 3:49 PM, austin seipp <as at hacks.yi.org> wrote:
> I don't know why GHC doesn't have this rule by default, though. We can
> at least rig it with a RULES pragma, however:
>
> $ cat concatmap.hs
> module Main where
>
> {-# RULES
> "concatMap/foldr" forall x k. concatMap k x = foldr ((++) . k) [] x
>  #-}

Well, that's the definition of concatMap :) [1], at least since as
long as Hackage can go [2].  So the problem seems something else.

Cheers,

[1] http://hackage.haskell.org/packages/archive/base/4.3.1.0/doc/html/src/GHC-List.html#concatMap
[2] http://hackage.haskell.org/packages/archive/base/3.0.3.1/doc/html/src/GHC-List.html#concatMap

-- 
Felipe.



More information about the Haskell-Cafe mailing list