[Haskell] Re: overuse of maybe and [] in prelude and libs, PS

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Thu Apr 8 09:47:20 EDT 2004


> Subject: [Haskell] overuse of maybe and [] in prelude and libs
> Date: Wed, 7 Apr 2004 23:41:55 -0400 (Eastern Standard Time)
> From: "S. Alexander Jacobson" <alex at alexjacobson.com>
> To: Haskell Mailing List <haskell at CS.YALE.EDU>
>
> ...
> 
> PS Shouldn't concat be defined with foldl and not
> foldr?  Doesn't foldr imply that you can't concat
> infinite lists?  (I know this is a FAQ, but
> where?)

Quite in contrary:

  foldl (++) [] [[i] | i <- [1..]]

fails to terminate, whereas 

  foldr (++) [] [[i] | i <- [1..]]

happily produces output.

Ciao, Janis.


--
Janis Voigtlaender
http://wwwtcs.inf.tu-dresden.de/~voigt/
mailto:voigt at tcs.inf.tu-dresden.de


More information about the Haskell mailing list