| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Overloaded.Plugin
Description
Overloaded plugin, which makes magic possible.
Documentation
Overloaded plugin.
To enable plugin put the following at top of the module:
{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-}
At least one option is required, multiple can given
either using multiple -fplugin-opt options, or by separating options
with colon:
{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols:Numerals #-}
Options also take optional desugaring names, for example
{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Labels=Data.Generics.ProductFields.field #-}
to desugar OverloadedLabels directly into field from generics-lens (no need to import orphan instance!)
Supported options
Symbolsdesugars literal strings tofromSymbol@symStringsworks like built-inOverloadedStrings(but you can use different method thanfromString)Numeralsdesugars literal numbers tofromNumeral@natNaturalsdesugars literal numbers to(i.e. likefromNaturalnatfromString)Charsdesugars literal characters to. Note: there isn't type-level alternative: we cannot promotefromCharscChars.Listsis not like built-inOverloadedLists, but desugars explicit lists toconsandnilIfdesugarsif-expressions toifteb t eLabelsworks like built-inOverloadedLabels(you should enableOverloadedLabelsso parser recognises the syntax)TypeNatsandTypeSymbolsdesugar type-level literals intoandFromNatrespectively.FromTypeSymbol
Known limitations
- Doesn't desugar inside patterns