Question about ghc case analysis

Adrian Hey ahey at iee.org
Tue Aug 9 07:24:33 EDT 2005


Hello,

Well this is actually a couple of questions..

First question is how does ghc do case analysis on algebraic
data type constructors. I always assumed it was by using some
kind of jump table on a tag field, but I don't know really (I'm
not even sure ghc makes use of tag fields as such).

Second question is really the same question but for literals.
What search algorithm is employed and is it likely to be
worth hand coding something else? (a binary search maybe).

I'm thinking of code like this..
 case n of
 0     ->
 7     ->
 34622 ->
 .. lots more
 _     ->

Thanks
--
Adrian Hey



More information about the Glasgow-haskell-users mailing list