úÎ!^JW^k      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ab c d e f g h i j Safe" overloaded Class for k-like datastructuresA character literal x is desugared to  'x' Safe ½ overloaded Class for l-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. overloadedm is n overloadedo is nNone&'-.=?@ACHUVXÓ  overloadedClass for Cons :.  overloadedClass for nil, []0See test-suite for ways to define instances for   . There are at-least two-ways.  overloaded overloaded overloaded overloaded overloaded overloaded  overloaded! overloaded" overloaded# overloaded$ overloaded   5None&'-.=?@ACHUVXš' overloadedBidirectional class for Cons :. '())'( (5Safek3 overloaded Class for p-like datastructuresA numeric literal 42 is desugared to 4 42 3434None&'.=?@AHUVXkQ7 overloaded Another way to desugar numerals.A numeric literal 123 is desugared to 8 @123  Enabled with: E{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Numerals #-} -One can do type-level computations with this.9 overloadedDefault implementation of 8.Usage example:  instance (q n, ...) => 7 n MyType where 8 = 9 @n = overloaded'TODO: currently there is no range check789789None"#XKTr overloaded5Non-empty binary tree, with elements at branches too.s overloadedModule name and variable nameK 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 ks.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 t! f (Leaf x) = Leaf (f x) t f (Branch l r) = Branch (t f l) (t+ f r) instance Traversable Tree where u' f (Leaf x) = [| Leaf (f x) |] u f (Branch l r) = [| Branch (u f l) (u f r) |] v overloaded$Match nested function applications, w: f x y z ~> f :| [x,y,z]x overloaded$Match nested operator applications, yC. x + y * z ~> Branch (+) (Leaf x) (Branch (*) (Leaf y) (Leaf z))z overloadedMake newtype class evidenceKKNone&'.=?@AHUVXkO‘Z overloadedCAnother way to desugar overloaded string literals using this class.A string literal  "example" is desugared to [ @"example"  Enabled with: D{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:Symbols #-} Z[Z[{7 None-.HVRĉb overloadedA way to overload type level |s.A number type-literal 42 is desugared to c 42  Enabled with: E{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeNats #-} bcbc Safe-.HVVlh overloadedA way to overload type level }s.A symbol type-literal  "example" is desugared to i "example"  Enabled with: H{-# OPTIONS -fplugin=Overloaded -fplugin-opt=Overloaded:TypeSymbols #-} hihiNoneV² 34789KZ[bchiKZ[78934 bchi~ !"#$%&'()*+,-./0123456789:;<=>?$6789:;<=?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde fghijk l  m n o p q  rstustvwxystzw{|w}~w€‚wƒ„w…†‡ˆ‰Š‹ˆ‰ŒŽstst‘%overloaded-0.2-3Q0Js9Is7zuJmPeCJnS8S5Overloaded.Chars Overloaded.IfOverloaded.ListsOverloaded.Lists.BidiOverloaded.NaturalsOverloaded.NumeralsOverloaded.PluginOverloaded.SymbolsOverloaded.TypeNatsOverloaded.TypeSymbolsData.MapMap fromSymbol Data.String fromString fromNumeral fromNatural fromCharsconsnilifteFromNatFromTypeSymbolGHC.Records.CompatHasFieldhasField OverloadedFromCharfromChar$fFromCharCharToBooltoBool$fToBoolEither $fToBoolMaybe $fToBoolBoolConsNilfromList $fNilRAVec $fNilRAList$fNilPOP$fNilNP$fNilVec $fNilIntMap$fNilMap$fNilSeq $fNilIntSet$fNilSet$fNil[]$fConsaRAVecNERAVec$fConsaRAVecRAVec$fConsaRAListNERAList$fConsaRAListRAList$fConsNPPOPPOP $fConsfNPNP $fConsaVecVec$fCons(,)IntMapIntMap$fCons(,)MapMap $fConsaSeqSeq$fConsIntIntSetIntSet $fConsaSetSet$fConsa[]NonEmpty $fConsa[][] FromNatural$fFromNaturalInteger$fFromNaturalNatural FromNumeraldefaultFromNumeral$fFromNumeralnBinP$fFromNumeralnBin$fFromNumeralnNat$fFromNumeralnInt$fFromNumeralnInteger$fFromNumeralnNatural$fFromNumeralnWord64$fFromNumeralnWord32$fFromNumeralnWord16$fFromNumeralnWord8$fFromNumeralnFin$fFinFromNumeralSS$fFinFromNumeralZS$fFromNumeralnPos$fFromNumeralnPosP$fPosFromNumeralSb$fPosFromNumeralZbplugin $fEqOnOff $fShowOnOff $fEqVarName $fShowVarName $fEqNumNat $fShowNumNat $fEqStrSym $fShowStrSym$fEqV2$fShowV2 $fEqOptions $fShowOptions$fEqV4$fShowV4 FromSymbol$fFromSymbolsText$fFromSymbolsText0$fFromSymbols[]$fFromSymbolsByteString$fFromSymbolsByteString0$fFromSymbolsDayFromNatC$fFromNatCBinP $fFromNatCBin $fFromNatCNat$fFromNatCNat0FromTypeSymbolC$fFromTypeSymbolCSymbolghc-prim GHC.TypesCharBoolbase Data.EitherRightTrue GHC.MaybeJust GHC.NaturalNatural GHC.TypeNatsKnownNatBTVarNameGHC.BasefmapData.TraversabletraversematchAppghcHsExprHsAppmatchOpOpApp makeEvidence4**NatSymbol