úÎ!UŽP¨F      !"#$%&'()*+,-./0123456789:;<=>?@ABC D E SafeA overloaded Class for F-like datastructuresA character literal x is desugared to  'x' Safe Ü overloaded Class for G-like datastrucutresAn if- -expression if b then t else e is desugared to ifte ( b) t e  Enabled with: ?{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:If #-}  overloaded overloaded if -expression. overloadedH is I overloadedJ is INone&'.=?@ACHUVX ÷  overloadedClass for Cons :.  overloadedClass for nil, []0See test-suite for ways to define instances for   . There are at-least two-ways.  Safeµ overloaded Class for K-like datastructuresA numeric literal 42 is desugared to  42 None&'.=?@AHUVXk› overloaded Another way to desugar numerals.A numeric literal 123 is desugared to  @123  Enabled with: E{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Numerals #-} -One can do type-level computations with this. overloadedDefault implementation of .Usage example:  instance (L n, ...) =>  n MyType where  =  @n  overloaded'TODO: currently there is no range checkNone"#XDžM overloaded5Non-empty binary tree, with elements at branches too.N overloadedModule name and variable name( overloaded Overloaded plugin.8To enable plugin put the following at top of the module: D{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-} KAt least one option is required, multiple can given either using multiple  -fplugin-opt/ options, or by separating options with colon: M{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols:Numerals #-} 8Options also take optional desugaring names, for example e{-# 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 Symbols desugars literal strings to   @symStrings works like built-in OverloadedStrings( (but you can use different method than  )Numerals desugars literal numbers to  @natNaturals desugars literal numbers to  nat (i.e. like  )Chars desugars literal characters to  c. Note:7 there isn't type-level alternative: we cannot promote Fs.Lists is not like built-in OverloadedLists!, but desugars explicit lists to  and If desugars if-expressions to  b t eLabels works like built-in OverloadedLabels (you should enable OverloadedLabels! so parser recognises the syntax)TypeNats and  TypeSymbols" desugar type-level literals into  and   respectively.Known limitationsDoesn't desugar inside patterns RecordFieldsWARNING= the type-checker plugin is experimental, it's adviced to use !{-# OPTIONS_GHC -ddump-simpl #-} to avoid surprising segfaults.UsageH{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:RecordFields #-}Implementation bits!See Note [HasField instances] in ClsInst), the behavior of this plugin is similar.The  class is defined in GHC.Records.Compat module of record-hasfield package: class  {k} x r a | x r -> a where  :: r -> (a -> r, a) Suppose we have data R y = MkR { foo :: [y] } and foo) in scope. We will solve constraints like HasField "foo" (R Int) a #by emitting a new wanted constraint  [Int] ~# a and building a HasField dictionary out of selector foo appropriately cast.)Idiom brackets from TemplateHaskellQuotes á{-# LANGUAGE TemplateHaskellQuotes #-} {-# OPTIONS_GHC -fplugin=Overloaded -fplugin-opt=Overloaded:IdiomBrackets #-} data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving (Show) instance Functor Tree where O! f (Leaf x) = Leaf (f x) O f (Branch l r) = Branch (O f l) (O+ f r) instance Traversable Tree where P' f (Leaf x) = [| Leaf (f x) |] P f (Branch l r) = [| Branch (P f l) (P f r) |] Q overloaded$Match nested function applications, R: f x y z ~> f :| [x,y,z]S overloaded$Match nested operator applications, TC. x + y * z ~> Branch (+) (Leaf x) (Branch (*) (Leaf y) (Leaf z))U overloadedMake newtype class evidence((None&'.=?@AHUVXkHÛ7 overloadedCAnother way to desugar overloaded string literals using this class.A string literal  "example" is desugared to 8 @"example"  Enabled with: D{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-} 7878V7None-.HVL0? overloadedA way to overload type level Ws.A number type-literal 42 is desugared to @ 42  Enabled with: E{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeNats #-} ?@?@ Safe-.HVO¶C overloadedA way to overload type level Xs.A symbol type-literal  "example" is desugared to D "example"  Enabled with: H{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeSymbols #-} CDCDNoneOü (78?@CD(78 ?@CDY !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLM NOPQRSTUV W  XYZ[YZ\]^_YZ`]ab]cd]efgh]ij]klmnopqnorstYZuYZvw'overloaded-0.1.2-6lal3JlWEOD49mOX8GjOtHOverloaded.Chars Overloaded.IfOverloaded.ListsOverloaded.NaturalsOverloaded.NumeralsOverloaded.PluginOverloaded.SymbolsOverloaded.TypeNatsOverloaded.TypeSymbolsData.MapMap fromSymbol Data.String fromString fromNumeral fromNatural fromCharsconsnilifteFromNatFromTypeSymbolGHC.Records.CompatHasFieldhasField OverloadedFromCharfromChar$fFromCharCharToBooltoBool$fToBoolEither $fToBoolMaybe $fToBoolBoolConsNil$fNilPOP$fNilNP$fNilVec$fNil[]$fConsNPPOPPOP $fConsfNPNP $fConsaVecVec$fConsa[]NonEmpty $fConsa[][] FromNatural$fFromNaturalInteger$fFromNaturalNatural FromNumeraldefaultFromNumeral$fFromNumeralnNat$fFromNumeralnInt$fFromNumeralnInteger$fFromNumeralnNatural$fFromNumeralnWord64$fFromNumeralnWord32$fFromNumeralnWord16$fFromNumeralnWord8$fFromNumeralnFin$fFinFromNumeralSS$fFinFromNumeralZSplugin $fEqOnOff $fShowOnOff $fEqVarName $fShowVarName $fEqNumNat $fShowNumNat $fEqStrSym $fShowStrSym$fEqV2$fShowV2 $fEqOptions $fShowOptions$fEqV4$fShowV4 FromSymbol$fFromSymbolsText$fFromSymbolsText0$fFromSymbols[]$fFromSymbolsByteString$fFromSymbolsByteString0$fFromSymbolsDayFromNatC $fFromNatCNat$fFromNatCNat0FromTypeSymbolC$fFromTypeSymbolCSymbolghc-prim GHC.TypesCharBoolbase Data.EitherRightTrue GHC.MaybeJust GHC.NaturalNatural GHC.TypeNatsKnownNatBTVarNameGHC.BasefmapData.TraversabletraversematchAppghcHsExprHsAppmatchOpOpApp makeEvidence4**NatSymbol