CTRex
CTRex copied to clipboard
Define Label as an instance of IsLabel from
Is there any reason to not add an instance of IsLabel, import GHC.OverloadedLabels, for Label? A suitable instance, for example, is:
instance l ~ l' => IsLabel (l :: Symbol) (Label l') where
fromLabel = Label
This could then be combined with the RebindableSyntax extension, allowing labels to be written simply as #s, for example, which would be translated to:
fromLabel @s
and used in the context where a Label was expected would cause that instance to be selected. I've added this to OpenRecords.hs (HEAD) and did some simple tests, so far seems to work as expected.
No reason, the OverloadedLabels extension did not exist yet when writing this library. Maybe you can create a pull request?
Will do.