Why no exposed `NullAddr#` literal?
Haskell Community [Unofficial]
May 27, 2026
thesnakefromthelemma:
>
> myNullAddr# :: MyAddr#
> myNullAddr# = WrapAddr# nullAddr#
>
>
> but this is of course disallowed, being an unlifted top-level binding. Fair enough!
I’m not sure it is fair, or at least there could in principle be an exception for values, and a newtype constructor applied to a value would be value. Maybe that adds too much extra complexity to be worth it.
thesnakefromthelemma:
> the best workaround of which I’m currently aware is to use the standard top-level-unlifted-value binding trick
Yeah, that’s what I’ve been using.
jaror:
> I expected this:
>
>
> myNullAddr# :: (() :: Constraint) => MyAddr#
> myNullAddr# = WrapAddr# nullAddr#
>
>
> Which makes is basically as easy to use as the pattern synonym.
That’s a nice alternative!
Discussion in the ATmosphere