Îõ³h&3/<î      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklm  Trustworthy)/0345789:>?ËÐØÙÛ÷€nlinear-genericsCopyPkgModule f g9 copies the module and package name from representation f to representation g!. Everything else is left alone.olinear-generics‚This type is used solely to get the name of this very module and the package it's in, reliably. It must be in the same module as U!Ulinear-genericsÃTypes with nonlinear or multiplicity-polymorphic fields should use MP1 under S1Ü. Unfortunately, Template Haskell (and GHC Generics) currently lack any support for such types, so their instances must currently be written entirely manually. We may add some functions to ease the pain at some point.ÈGeneric-deriving classes that do not involve linear types should treat MP1 m much as they treat M1”: dig through it to get to the meat. Unfortunately, some futzing about may be necessary to convince the type checker that multiplicities work out.ÁGeneric-deriving classes that use linear types may have to treat MP1 m7 specially. In particular, they may need to constrain m to be 'p or 'q(, or to match some other type variable.Wlinear-genericsŒThe composition operator for types. We use our own here because for many classes, it's possible to share generic deriving classes between  GHC.Generics and Generics.LinearÁ by just instantiating them for both composition operators (and U).Zlinear-genericsGeneric1 is similar to  GHC.Generics.Z, but has a few differences.Multiplicity polymorphismAs with ^, the to1 and from1' methods are multiplicity polymorphic.Differences in [ representationr is not usedGiven a type like newtype Foo a = Foo (Maybe a) &where a single type constructor (here Maybe ) is applied to the parameter,  GHC.Generics represents the field as r Maybe!. We instead represent it using Par1 :.: Maybe2. It is expected that very few real-life uses of  GHC.GenericsØ will break as a result, and this simplification means that users don't have to write r. instances for their generic-deriving classes.,Compositions associate in the opposite orderGiven a type like )newtype Bar a = Bar (Maybe [Either e a]) êwhere multiple type constructors are layered around the parameter, "GHC.Generics@ represents the field as Maybe s ([] s r (Either e)) We instead represent it as (( W Maybe) W []) W Either e Doing it this way prevents \ and ] from having to tŽ newtype constructors through the composed types, which can be a considerable performance improvement and enables multiplicity polymorphism.½In most cases, modifying generic-deriving classes to accommodate this change is simple: just swap which side of the composition is treated as a generic representation and which as a base type. In a few cases, more restructuring will be needed, which will require using different generic-deriving classes than for  GHC.Generics.Difference in specificityÍUsers of type application will need to be aware that the kind parameter for Z$ is marked as inferred, whereas for  GHC.Generics.Z= it is marked as specified. So you should use, for example,  to1 @Maybe rather than  to1 @_ @Maybe.^linear-genericsGeneric is exactly the same as  GHC.Generics.^ except that ` and aÿ are multiplicity polymorphic. This means they will work equally well in traditional Haskell code and in linearly typed code.blinear-genericsExtract the value from an U.ãIJLKMON9:<;6>=CBA@RQ S *+,-./0123547 8#!"?)'(DGFEH&$%PTUVWXYZ[]\^_a`bW7 Safe-Inferred /03ÉËØÙ uvwxyz{|}~u9 #(c) 2008--2009 Universiteit UtrechtBSD3generics@haskell.org experimental non-portable Safe-Inferred0ËÙâ"x!linear-generics A version of €È in which the data family instance constructors come equipped with the 7 of the first constructor in the family instance (for ‚ generation purposes).ƒlinear-genericsÄRecords information about the type variables of a data type with a „ or … instance.†linear-generics%Information about a data type with a „ instance.‡linear-generics%Information about a data type with a … instance.ˆlinear-generics4All of the type variable arguments to the data type.‰linear-genericsÑAll of the type variable arguments to the data type except the last one. In a … (T a_1 ... a_(n-1)) instance, the ‰ would be [a_1, ..., a_(n-1)].Šlinear-genericsÆThe name of the last type variable argument to the data type. In a … (T a_1 ... a_(n-1)) instance, the Š name would be a_n.‹linear-generics7Indicates whether Generic or Generic1 is being derived.Œlinear-genericsÅIf a Type is a SigT, returns its kind signature. Otherwise, return *.linear-genericsTurns  [a, b] c into  a -> b -> c Žlinear-genericsTurns  [k1, k2] k3 into k1 -> k2 -> k3 linear-genericsRemove any outer  and ‘& constructors, and turn an outermost ’% constructor into plain applications.“linear-genericsÁChecks whether a type is an unsaturated type family application.”linear-genericsØGiven a name, check if that name is a type family. If so, return a list of its binders.•linear-generics*True if the type does not mention the Name–linear-generics)Construct a type via curried application.—linear-genericsËGenerate a list of fresh names with a common prefix, and numbered suffixes.˜linear-genericsŸChecks to see if the last types in a data family instance can be safely eta- reduced (i.e., dropped), given the other types. This checks for three conditions: +All of the dropped types are type variables%All of the dropped types are distinctCannot have a constructor argument of form (forall a1 ... an.  type) when deriving Generic(1)¥linear-generics"Boilerplate for top level splices.-The given Name must meet one of two criteria: ÊIt must be the name of a type constructor of a plain data type or newtype.ÎIt must be the name of a data family instance or newtype instance constructor.,Any other value will result in an exception.¦linear-genericsŠOne cannot derive Generic(1) instance for anything that uses DatatypeContexts, so check to make sure the Cxt field of a datatype is null.§linear-genericsÉDeriving Generic(1) doesn't work with ExistentialQuantification or GADTs.,¨©ª«ƒŠ‰ˆ‡†‹…„ŒŽ“”•–—˜™š›œ¬­®¯°žŸ ¡¢£¤¥¦§#(c) 2008--2009 Universiteit UtrechtBSD3generics@haskell.org experimental non-portable Safe-Inferred0ËÙ#V±²³´µ¶#(c) 2008--2009 Universiteit UtrechtBSD3David.Feuer@gmail.com experimental non-portable Safe-Inferred '0ÉËÙ%æclinear-generics?Given the name of a type or data family constructor, derive a ‹ instance.dlinear-generics?Given the name of a type or data family constructor, derive a ‹ instance.elinear-generics?Given the name of a type or data family constructor, derive a ‹ instance and a ‹ instance.·linear-genericsGeneric or Generic1linear-generics(The type constructor or data family namelinear-generics*The types to instantiate the instance withcdecde Safe-Inferred/0ËÙ&  Safe-Inferred /0ËØÙ&O  Safe-Inferred0ËÙ&  Safe-Inferred /0ÀÂËØÙé&¸  Trustworthy0ËÙ&äSafe0ËÙ' åIJLKMON9:<;6>=CBA@RQ S *+,-./0123547 8#!"?)'(DGFEH&$%PTUVWXYZ\[][^`_a_bã^_a`Z[]\WXYUVbIJLKMON9:<;6>=CBA@RQ S *+,-./0123547 8#!"?)'(DGFEH&$%PTUnsafe/013ÀÁÂÃÄËØÙÛîó÷/flinear-genericsWhen f a is an instance of  GHC.Generics.¸ for all a, GHCGenerically1 f is an instance of Z.WarningGHCGenerically1 is intended for use as a  DerivingVia! target. Most other uses of its Z instance will be quite wrong.GHCGenerically1 must notœ be used with datatypes that have nonlinear or linearity-polymorphic fields. Doing so will produce completely bogus results, breaking the linearity rules.GHCGenerically1 is otherwise safe to use with derived  GHC.Generics.¸Ž instances, which are linear. If you choose to use it with a hand-written instance, you should check that the underlying instance is linear.Example Îdata Foo a = Bar a (Either Int a) | Baz (Maybe a) Int deriving stock (Show,  GHC.Generics.¸ ) deriving Z via GHCGenerically1 Foo ilinear-genericsWhen a is an instance of  GHC.Generics.¸, GHCGenerically a is an instance of ^.WarningsGHCGenerically is intended for use as a  DerivingVia! target. Most other uses of its ^ instance will be quite wrong.GHCGenerically must notœ be used with datatypes that have nonlinear or linearity-polymorphic fields. Doing so will produce completely bogus results, breaking the linearity rules.GHCGenerically is otherwise safe to use with derived  GHC.Generics.¸Ž instances, which are linear. If you choose to use it with a hand-written instance, you should check that the underlying instance is linear.Example Îdata Foo a = Bar a (Either Int a) | Baz (Maybe a) Int deriving stock (Show,  GHC.Generics.¸ ) deriving ^ via GHCGenerically (Foo a) fghijkijkfgh¹9 º8»                   ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ' & % $ # "  ? @ A B C D E  F G  H  I J K L M N O P Q R S T U V W  XYYZ[\]^_`abcdefghiijkklmnopqrsqrt u Z vwx>=<:;9\HEyz{|z{}~€a]‚ƒ„…†‡ˆ‰Š‹~Œ~~Ž‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­­®¯°±² a³´µlinear-generics-0.2-inplaceGenerics.LinearGenerics.Linear.TH%Generics.Linear.Unsafe.ViaGHCGenericsGenerics.Linear.ClassGenerics.Linear.TH.InsertionsGenerics.Linear.TH.InternalGenerics.Linear.TH.MetaData*Generics.Linear.Instances.Template_haskell)Generics.Linear.Instances.Linear_generics$Generics.Linear.Instances.ContainersGenerics.Linear.Instances.BaseGenerics.Linear.Instancesbase GHC.GenericsDatatype ConstructorSelectorV1U1Par1K1M1:+::*:RDCSRec0D1C1S1URecUAddrUCharUDoubleUFloatUIntUWordPrefixIInfixILeftAssociativeRightAssociativeNotAssociative SourceUnpackSourceNoUnpackNoSourceUnpackedness SourceLazy SourceStrictNoSourceStrictness DecidedLazy DecidedStrict DecidedUnpackMetaDataMetaConsMetaSeluWord#uInt#uFloat#uDouble#uChar#uAddr#SourceUnpackednessSourceStrictnessselSourceUnpackednessselSourceStrictnessselNameselDecidedStrictnessunPar1MetaunM1unK1FixityIPrefixInfixFixityDecidedStrictness packageName moduleName isNewtype datatypeNameconName conIsRecord conFixity AssociativityR1L1precMP1:.:Comp1unComp1Generic1Rep1to1from1GenericReptofromunMP1 deriveGenericderiveGeneric1deriveGenericAnd1GHCGenerically1unGHCGenerically1GHCGenericallyunGHCGenerically$fGenericGHCGenerically$fGeneric1kGHCGenerically1 CopyPkgModuleForInfoghc-prim GHC.TypesOneManyRec1GHC.Basefmap.DatatypeVariant_×th-abstraction-0.4.3.0-23c1033bc1744c8c92576b7db8ca7d9309afdf122cbb151f56ba288cd6c0f506Language.Haskell.TH.DatatypeDatatypeVariantConstructorInfotemplate-haskellLanguage.Haskell.TH.SyntaxName GenericTvbsGen0Gen1gen0Tvbs gen1InitTvbsgen1LastTvbName GenericClasstypeKind makeFunType makeFunKinddustOffSigTParensTInfixTisUnsaturatedTypegetTypeFamilyBindersground applyTyToTys newNameList canEtaReduce varTToNameisTyVar isKindVar mentionsName allDistinct mkGenericTvbsgenericInitTvbsetaReductionErrorderivingKindErroroutOfPlaceTyVarErrortypeFamilyApplicationError rankNError reifyDataInfocheckDataContextcheckExistentialContextNewtypeInstance_ DataInstance_Newtype_ Datatype_fst3snd3trd3foldBalisNewtypeVariant SelStrictInfomkMetaDataTypemkMetaConsType mkMetaSelTypereifySelStrictInfobuildTypeInstance#..#