Skip to content

Strict let-bindings are processed backwards

Consider this module:

main = do let !x = error "bar"
              !y = error "foo"
          print (x + y)

or this analogous module:

{-# LANGUAGE MagicHash #-}
import GHC.Exts
main = do let x = error "bar" :: Int#
              y = error "foo" :: Int#
          print (I# x + I# y)

When you run these, you will get the error "foo" and not the error "bar". This is backwards!

Edited by Edward Z. Yang
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information