External Publication
Visit Post

Why no exposed `NullAddr#` literal?

Haskell Community [Unofficial] May 27, 2026
Source
TIL pattern synonyms can be unlifted. But then a bidirectional pattern should work: pattern MyNullAddr# :: MyAddr# pattern MyNullAddr# <- ((\(WrapAddr# x) -> eqAddr# nullAddr# x) -> 1#) where MyNullAddr# = WrapAddr# nullAddr# thesnakefromthelemma: > the standard top-level-unlifted-value binding trick I expected this: myNullAddr# :: (() :: Constraint) => MyAddr# myNullAddr# = WrapAddr# nullAddr# Which makes is basically as easy to use as the pattern synonym. The downside of this approach in general is that the value is not shared, but in this case it does not do any work so that shouldn’t be an issue. And the pattern synonym has the same downside.

Discussion in the ATmosphere

Loading comments...