Simon M:
> Quite possibly - pattern matching on strings involves building a
> dictionary for Eq [Char], unpacking the string (it's represented as
> packed in the object code), and performing the comparison. This is
> probably bad.
Ah-hah, I didn't realise there was unpacking going on too; that may
explain a lot. I've converted to an enumeration type, to avoid this
happening in an "inner loop", and was mildly boggled at how much
difference it make.
> Try replacing
>
> f "aa" = ...
>
> with
>
> f ('a':'a':[]) = ...
I'll bear this in mind for the _next_ time I run into this...
Ta,
Alex.