Skip to content

Allow Overloaded things in patterns

This ticket is motivated by the use of OverloadedLabels of the choice package.

One can use a type Choice "block" with values Do #block and Don't #block by using OverloadedLabels. However, in patterns this syntax is forbidden.

case block of
  Do    #block -> ...
  Don't #block -> ...

It would be nice if overloaded labels desugared to something sensible in patterns, perhaps

case block of
  Do    ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ...
  Don't ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ...

OverloadedLists and OverloadedStrings could benefit from a similar solution.

Edited by Facundo Domínguez
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information