Unboxed things that don't contain pointers probably don't need to be garbage collected, right?
Tom Ellis <tom-lists-haskell-cafe-2017@jaguarpaw.co.uk> writes:
> I can't bind unlifted values at the top level:
>
> foo = (##)
>
> Top-level bindings for unlifted types aren't allowed: foo = (##)
>
> I can understand why I shouldn't be able to bind unlifted
> *expressions* at the top level
>
> foo = complicatedExpression
>
> Perhaps complicatedExpression doesn't terminate! But why can't I bind
> _values_, i.e. things that are already evaluated? Given that (##) and
> proxy# already exist at the top-level it seems reasonable that I
> should be allowed to define my own!
>
There are a few things going on here. The case you give here is not just
unlifted but also unboxed (namely, being an unboxed tuple). It's hard to
see how top-level binding of unboxed values would work operationally
(e.g. how is the garbage collector to know how to trace this object,
given that unboxed objects have no object header?).
However, I suspect you do have a point when it comes to unlifted data
constructors. I think it would be fine to allow an application of a
data constructor of an unlifted type on the top-level:
type UMaybe :: Type -> UnliftedType
data UMaybe a = UNothing | UJust a
x :: UMaybe Int
x = UJust 42
Perhaps you could open a ticket for this?
Cheers,
- Ben
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.