Top-level bindings for unlifted types

Simon Peyton-Jones simonpj at microsoft.com
Tue Nov 13 06:50:35 EST 2007


What would you expect to happen for this?

fib :: Int -> Int#
fib n = ...

x :: Int#
x = fib 100#


'x' cannot be bound to a thunk.  So the top-level computation would have to be evaluated eagerly.  But when?  Perhaps when the program starts?  Maybe one could do that, but we have not done so.

Top-level unboxed *values* would be ok, but the type checker has no notion of a "value" at the moment.

Simon

| -----Original Message-----
| From: glasgow-haskell-users-bounces at haskell.org [mailto:glasgow-haskell-users-bounces at haskell.org] On Behalf Of
| Neil Mitchell
| Sent: 13 November 2007 11:07
| To: glasgow-haskell-users at haskell.org
| Subject: Top-level bindings for unlifted types
|
| Hi,
|
| The following program:
|
| -------------------------------------------
| {-# OPTIONS_GHC -fglasgow-exts #-}
| module Test() where
| import GHC.Base
| test = realWorld#
| -----------------------------------------
|
| gives the error message:
|
|     Top-level bindings for unlifted types aren't allowed:
|         { test = realWorld# }
|
| Changing to test _ = realWorld# works fine.
|
| The question is why are these bindings disallowed? Reading the
| "Unboxed values as first class citizens" paper I can't see it listed
| as a restriction.
|
| Thanks
|
| Neil
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users at haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


More information about the Glasgow-haskell-users mailing list