[Haskell-beginners] A first try
David Place
d at vidplace.com
Fri Jun 24 14:43:59 CEST 2011
Hi, Panagiotis.
The wc program is a good choice for a learning program, but it reveals a long-standing weakness in Haskell: Lazy-IO. I think you will find that your program will get an error if you try to run wc on many files. You will open too many files at once.
There is a solution called IterateeIO. It's extremely elegant and very good Haskell, but quite challenging to understand. So far, I have not found a good tutorial.
Luck for you the best example program is an implementation of wc!
I posted it in hpaste.org. (A Haskell-specific version of pasteBin.)
> http://hpaste.org/48254
Cheers,
David
____________________
David Place
Owner, Panpipes Ho! LLC
http://panpipesho.com
d at vidplace.com
On Jun 24, 2011, at 7:48 AM, Panagiotis Koutsourakis wrote:
> Hello all,
>
> I've been spending some time recently learning Haskell. I am not a
> newbie in programming, and I've had some experience with lisp in the
> past, but I have not really studied functional programming. I am
> mostly seeking feedback regarding style, and glaring mistakes that I
> may make in some toy examples, but I am not sure if this is the proper
> place to ask.
>
> In case it is though, here is an attempt (not yet complete) at the
> word count program:
>
> http://pastebin.com/JZw22QGA
>
> Thanks in advance!
>
> --
> Panagiotis Koutsourakis
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
More information about the Beginners
mailing list