[Haskell-cafe] How does GHC's implementation of par work?

Ryan Ingram ryani.spam at gmail.com
Tue May 26 22:17:37 EDT 2009

I saw your paper on LtU last week.  Here's an extra plug: I really enjoyed it.

When can we expect to see Strict Core replacing System Fc?  :)

  -- ryan

On Tue, May 26, 2009 at 5:32 PM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> 2009/5/26 Ryan Ingram <ryani.spam at gmail.com>:
>> What causes par# to
>> get executed?  Does GHC overload case for unboxed return values to
>> force the evaluation of the scrutinee even if its return value isn't
>> used?
> As you noted, the type of "par" is a -> Int#. Furthermore, the only
> possible evaluation semantics for unboxed types in GHC's intermediate
> language is strict. This means that your case expression has to
> evaluate the scrutinee eagerly.
> Indeed, consider the following program (which looks even lazier than
> your example):
> let x :: Int# = error "boom!"
> in 10
> This will diverge in either Haskell or Core, because both languages
> promise that if have an unlifted thing in your environment /it really
> has been evaluated/. SPJ and I recently wrote a paper [1] proposing an
> intermediate language for GHC that would allow Core to express thunks
> of unlifted types, but even so I don't think we would actually want to
> change the semantics of bindings of unlifted types in Haskell.
> Cheers,
> Max
> [1] http://www.cl.cam.ac.uk/~mb566/papers/tacc-hs09.pdf
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list