optimization question

Max Kirillov max630 at mail.ru
Mon Feb 23 22:24:06 EST 2004

On Sun, Feb 22, 2004 at 12:20:35AM -0800, John Meacham wrote:
> case x of 
>         "foo" -> Foo
>         "bar" -> Bar
>         "fuzz" -> Fuzz
>         "fuzo" -> Fuzo
>         x -> other .. thing

> The reason I ask is I am writing someting which will generate large case
> statements like the first form and want to know if I should bother
> pre-optimizing it to the second.
>         John

I suppose such things should be made by flex-style generators. Haskell
has one (called Happy); I wonder how efficient it is compared to
hand-written "case .. of" or "if .. = .." scanners. I've heard flex is
at least not worse than hand-written C code.


More information about the Glasgow-haskell-users mailing list