Case expressions in STG

Tom Ellis tom-lists-ghc-devs at jaguarpaw.co.uk
Wed Jun 18 13:43:05 UTC 2014


I am reading SPJ's seminal work "Implementing lazy functional languages on
stock hardware: the Spinless Tagless G-machine" (1992).  The paper is
available here

    http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.53.3729

On p62 we see "The expression scrutinised by a case expression must
eventually evaluate either to a primitive value or a constructor
application.".

This doesn't make sense to me.  Isn't the following a valid STG program? 
What am I missing?  Where is it specified that the scrutinee of a case
expression cannot be of a function type?

{x} \n {z} -> let f = \{x} \n {y} -> g x y
              in case f of f' -> f' z

Thanks,

Tom


More information about the ghc-devs mailing list