[Haskell-cafe] Why can't I bind unlifted values at the top level?

Tom Ellis tom-lists-haskell-cafe-2017 at jaguarpaw.co.uk
Sat Jan 21 22:06:13 UTC 2023

On Sat, Jan 21, 2023 at 10:52:33PM +0100, Jaro Reinders wrote:
> On 21-01-2023 20:00, Ben Gamari wrote:
> > 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?
> This ticket seems related: #17521 Consider top-level unlifted bindings [1].
> Or do you think it needs a separate ticket?

Thanks Jaro.  That ticket contains the observation

"there are other cases where unlifted types are desireable at the
 top-level (e.g. saturated data constructor applications). In
 principle it would be fairly straightforward to incorporate a
 validity check that admits top-level constructor applications which
 rejecting function applications if we wanted."

So I think that ticket subsumes my question, and filing another one
would be redundant.


More information about the Haskell-Cafe mailing list