Prefix form of unboxed tuple

Isaac Dupree isaacdupree at charter.net
Fri Jul 6 09:03:40 EDT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Meacham wrote:
> On Fri, Jul 06, 2007 at 11:26:00AM +0100, Neil Mitchell wrote:
>> ghci -fglasgow-exts
>> Prelude> case (# 1 , 2 #) of (# a , b #) -> error $ show (a,b)
>> *** Exception: (1,2)
>>
>> You might expect there to be a prefix form of the unboxed tuple:
>>
>> Prelude> case (#,#) 1 2 of (# a , b #) -> error $ show (a,b)
>> <interactive>:1:7: parse error on input `,'
>>
>> But there isn't. I've added special code into the Yhc code generator
>> to deal with this particular constructor, so it no longer effects me.
>>
> 
> Well, what would the type of (#,#) be? unboxed tuples can hold both
> boxed and unboxed values, so some sort of kind polymorphism would be
> needed to type the prefix form properly.

In GHC, some special functions have kind polymorphism
<http://hackage.haskell.org/trac/ghc/wiki/IntermediateTypes>
error :: forall a:?. String -> a
(->)  :: ?? -> ? -> *
(\(x::t) -> ...)	Here t::?? (i.e. not unboxed tuple)
(and <http://hackage.haskell.org/trac/ghc/changeset/2807>
    "But the 'real' type of error is:
forall bv. forall a:Type bv. String -> a ")

Or just saying it's illegal to partially apply (#,#) - which I believe
is how (some of) GHC's primops work.

Isaac
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGjj2rHgcxvIWYTTURAp03AJ4/kgTzuN6PHp5QFTOQBKJIKa8QtQCeLvjm
hh9TO2NDFzZ2N+FYsgOORGU=
=6GJm
-----END PGP SIGNATURE-----


More information about the Glasgow-haskell-users mailing list