[Haskell-cafe] Re: Why can't Haskell be faster?

Bryan O'Sullivan bos at serpentine.com
Thu Nov 1 11:19:00 EDT 2007


Ketil Malde wrote:

> Python used to do pretty well here compared
> to Haskell, with rather efficient hashes and text parsing, although I
> suspect ByteString IO and other optimizations may have changed that
> now. 

It still does just fine.  For typical "munge a file with regexps, lists, 
and maps" tasks, Python and Perl remain on par with comparably written 
Haskell.  This because the scripting-level code acts as a thin layer of 
glue around I/O, regexps, lists, and dicts, all of which are written in 
native code.

The Haskell regexp libraries actually give us something of a leg down 
with respect to Python and Perl.  The aggressive use of polymorphism in 
the return type of (=~) makes it hard to remember which of the possible 
return types gives me what information.  Not only did I write a regexp 
tutorial to understand the API in the first place, I have to reread it 
every time I want to match a regexp.

A suitable solution would be a return type of RegexpMatch a => Maybe a 
(to live alongside the existing types, but aiming to become the one 
that's easy to remember), with appropriate methods on a, but I don't 
have time to write up a patch.

	<b


More information about the Haskell-Cafe mailing list