Îõ³h*521#ò      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopq0.2.3  Trustworthy*015679:;<ÀÁÍÒÚÛÝùrlinear-genericsCopyPkgModule f g9 copies the module and package name from representation f to representation g!. Everything else is left alone.slinear-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 Y!Ylinear-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 't or 'u(, or to match some other type variable.[linear-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 Y).^linear-genericsGeneric1 is similar to  GHC.Generics., but has a few differences.Multiplicity polymorphismAs with b, the to1 and from1' methods are multiplicity polymorphic.Differences in _ representationv 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 v 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 v. 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 w ([] w v (Either e)) We instead represent it as (( [ Maybe) [ []) [ Either e Doing it this way prevents ` and a from having to xŽ 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 ^% is marked as inferred, whereas for  GHC.Generics.= it is marked as specified. So you should use, for example,  to1 @Maybe rather than  to1 @_ @Maybe.blinear-genericsGeneric is exactly the same as  GHC.Generics.b except that d and eÿ are multiplicity polymorphic. This means they will work equally well in traditional Haskell code and in linearly typed code.flinear-genericsExtract the value from an Y.çbced^_a`[\]YZf>?@A;<=/012KIJGHEFCD B VTRPNLMOQSUW*'()+,-.3$%&4!"#5 6789:X[7 Safe-Inferred 015ËÍÚÛ? yz{|}~€‚y9  #(c) 2008--2009 Universiteit UtrechtBSD3generics@haskell.org experimental non-portable Safe-Inferred1ÍÛä"£!ƒ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-Inferred1ÍÛ#‚µ¶·¸¹º#(c) 2008--2009 Universiteit UtrechtBSD3David.Feuer@gmail.com experimental non-portable Safe-Inferred (1ËÍÛ&glinear-generics?Given the name of a type or data family constructor, derive a b instance.hlinear-generics?Given the name of a type or data family constructor, derive a ^ instance.ilinear-generics?Given the name of a type or data family constructor, derive a b instance and a ^ instance.»linear-genericsGeneric or Generic1linear-generics(The type constructor or data family namelinear-generics*The types to instantiate the instance withghighi  Safe-Inferred01ÍÛ&D  Safe-Inferred 01ÍÚÛ&w  Safe-Inferred1ÍÛ&§ Safe-Inferred 01ÂÄÍÚÛë&ù¼linear-generics Trustworthy1ÍÛ'%Safe1ÍÛ'Jébced^_a`>?@A;<=/012KIJGHEFCD B[\] c_VTRPNLMOQSUW*'()+,-.3$%&4!"#5 6789:YZXfçbced^_a`[\]YZf>?@A;<=/012KIJGHEFCD B VTRPNLMOQSUW*'()+,-.3$%&4!"#5 6789:XUnsafe/0135ÂÃÄÅÆÍÚÛÝðõù1½linear-generics'Check whether a type is suitable for a ^ instance, using its ' representation. We used to just throw ¾ s in the _ã calculation. But that meant that type errors occurred only at use sites. Indeed, the situation was even worse than that: a representation could actually be constructed and (partially) explored when some of its contents had ¾ types. Yuck.jlinear-genericsWhen f a is an instance of  GHC.Generics.¿ for all a, GHCGenerically1 f is an instance of ^.WarningGHCGenerically1 is intended for use as a  DerivingVia! target. Most other uses of its ^ 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 ^ via GHCGenerically1 Foo mlinear-genericsWhen a is an instance of  GHC.Generics.¿, GHCGenerically a is an instance of b.WarningsGHCGenerically is intended for use as a  DerivingVia! target. Most other uses of its b 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 b via GHCGenerically (Foo a) mnojklmnojklÀ9 Á8 !"#$%&'()*+,-./0123456789:;<==>>?@ABCDEFGHIJKLMNOPQRSTUV*W)X(Y'Z&[%\]^^_`abcdefghijkllmnnopqrstuvtuwx_yz{\[ZXYWaUV |}~}~€‚ƒ „   … † ‡ ˆ ‰ Š ‹ Œ  Ž‚‚‚‘ ’ “ ” • – — ˜ ™ š › œ  ž Ÿ   ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ³ ´µ¶·¸¹º»¼,linear-generics-0.2.3-ANJqq0qJh2CG9cpsaG5pgPGenerics.LinearGenerics.Linear.TH%Generics.Linear.Unsafe.ViaGHCGenericslinear-genericsGenerics.Linear.Class GHC.GenericsGeneric1Generics.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.InstancesGenericbaseDatatype ConstructorSelectorV1U1Par1K1M1:+::*:RDCSRec0D1C1S1URecUAddrUCharUDoubleUFloatUIntUWordPrefixIInfixILeftAssociativeRightAssociativeNotAssociative SourceUnpackSourceNoUnpackNoSourceUnpackedness SourceLazy SourceStrictNoSourceStrictness DecidedLazy DecidedStrict DecidedUnpackMetaDataMetaConsMetaSelMeta Generically1 GenericallyselNameselSourceUnpackednessselSourceStrictnessselDecidedStrictnessDecidedStrictnessSourceStrictnessSourceUnpackedness AssociativityFixityIFixityPrefixInfixconName conFixity conIsRecord datatypeName moduleName packageName isNewtypeL1R1unM1unK1unPar1uWord#uInt#uFloat#uDouble#uChar#uAddr#precMP1:.:Comp1unComp1Rep1to1from1ReptofromunMP1 deriveGenericderiveGeneric1deriveGenericAnd1GHCGenerically1unGHCGenerically1GHCGenericallyunGHCGenerically$fGenericGHCGenerically$fGeneric1kGHCGenerically1 CopyPkgModuleForInfoghc-prim GHC.TypesOneManyRec1GHC.Basefmap.DatatypeVariant_-th-abstraction-0.6.0.0-Lnk8y08ddV941zGd880ET3Language.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_fst3snd3trd3foldBalisNewtypeVariantmkMetaDataTypemkMetaConsType mkMetaSelType SelStrictInforeifySelStrictInfobuildTypeInstance D:R:RepVoid CheckValid GHC.TypeError TypeError#..#