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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
| Neil Mitchell
| Sent: 13 November 2007 11:07
| To: glasgow-haskell-users@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@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to