derivingUnbox Let's consider a more complex example: suppose we want an Unbox
instance for Maybe a. We could encode this using the pair (Bool, a),
with the boolean indicating whether we have Nothing or Just something.
This encoding requires a dummy value in the Nothing case, necessitating an
additional Default
constraint. Thus:
derivingUnbox "Maybe"
[t| ∀ a. (Default a, Unbox a) ⇒ Maybe a → (Bool, a) |]
[| maybe (False, def) (\ x → (True, x)) |]
[| \ (b, x) → if b then Just x else Nothing |]