h$\      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ None358-" th-desugarCorresponds to TH's  DerivStrategy type.# th-desugarA "standard" derived instance$ th-desugar -XDeriveAnyClass% th-desugar -XGeneralizedNewtypeDeriving& th-desugar  -XDerivingVia' th-desugarCorresponds to TH's  DerivClause type.* th-desugarCorresponds to TH's Info type., th-desugarThe  Maybe Name stores the name of the enclosing definition (datatype, for a data constructor; class, for a method), if any. th-desugarThe Int is the arity; the Bool$ is whether this tycon is unlifted.0 th-desugarCorresponds to TH's TySynEqn' type (to store type family equations).2 th-desugarCorresponds to TH's RuleBndr type.5 th-desugarCorresponds to TH's Pragma type.= th-desugarCorresponds to TH's Foreign type.@ th-desugarCorresponds to TH's  VarBangType type.A th-desugarCorresponds to TH's BangType type.B th-desugar if a constructor is declared infix. For normal ADTs, this means that is was written in infix style. For example, both of the constructors below are declared infix. data Infix = Int  Int | Int :*: Int 9Whereas neither of these constructors are declared infix: -data Prefix = Prefix Int Int | (:+:) Int Int For GADTs, detecting whether a constructor is declared infix is a bit trickier, as one cannot write a GADT constructor "infix-style" like one can for normal ADT constructors. GHC considers a GADT constructor to be declared infix if it meets the following three criteria: %Its name uses operator syntax (e.g., (:*:)).2It has exactly two fields (without record syntax).1It has a programmer-specified fixity declaration.#For example, in the following GADT: infixl 5 :**:, :&&:, :^^:, ActuallyPrefix data InfixGADT a where (:**:) :: Int -> b -> InfixGADT (Maybe b) -- Only this one is infix ActuallyPrefix :: Char -> Bool -> InfixGADT Double (:&&:) :: { infixGADT1 :: b, infixGADT2 :: Int } -> InfixGADT  :^^:b :: Int -> Int -> Int -> InfixGADT Int (:!!:) :: Char -> Char -> InfixGADT Char  Only the (:**:) constructor is declared infix. The other constructors are not declared infix, because:ActuallyPrefix, does not use operator syntax (criterion 1).(:&&:)" uses record syntax (criterion 2).(:^^:)0 does not have exactly two fields (criterion 2).(:!!:) does not have a programmer-specified fixity declaration (criterion 3).C th-desugarA list of fields either for a standard data constructor or a record data constructor.F th-desugarCorresponds to TH's  type. Unlike , all F/s reflect GADT syntax. This is beneficial for  th-desugar's since it means that all data type declarations can support explicit return kinds, so one does not need to represent them with something like  y, since Haskell98-style data declaration syntax isn't used. Accordingly, there are some differences between F and  to keep in mind:Unlike , where the meaning of the 3s changes depending on whether it's followed by / or not, the meaning of the ts in a F6 is always the same: it is the list of universally and existentially quantified type variables. Note that it is not guaranteed that one set of type variables will appear before the other.A F$ always has an explicit return type.G th-desugarThe GADT result typeH th-desugarCorresponds to TH's  typeL th-desugarCorresponds to TH's  typeN th-desugarCorresponds to TH's  typeO th-desugarCorresponds to TH's  typeP th-desugar pattern P x {<-} pQ th-desugar pattern P x {=} pR th-desugar  pattern P x {<-} p where P x = eS th-desugarCorresponds to TH's Dec type.X th-desugarNote that the Maybe [DTyVarBndrUnit] field is dropped entirely when sweetened, so it is only useful for functions that directly consume DDecs.` th-desugarNote that the Maybe [DTyVarBndrUnit] field is dropped entirely when sweetened, so it is only useful for functions that directly consume DDecs.e th-desugarIs it a newtype or a data type?h th-desugarDeclarations as used in a let statement.n th-desugarCorresponds to TH's Clause type.p th-desugarCorresponds to TH's Match type.r th-desugarCorresponds to TH's  TyVarBndrUnits th-desugarCorresponds to TH's  TyVarBndrSpect th-desugarCorresponds to TH's  TyVarBndrw th-desugarCorresponds to TH's Cxtx th-desugar*Predicates are types. Corresponds to TH's Predy th-desugar%Kinds are types. Corresponds to TH's Kindz th-desugarThe type variable binders in a forall.{ th-desugar A visible forall (e.g., forall a -> {...}). These do not have any notion of specificity, so we use () as a placeholder value in the ts.| th-desugar An invisible forall (e.g., forall a {b} c -> {...}), where each binder has a !.} th-desugarCorresponds to TH's Type* type, used to represent types and kinds. th-desugarCorresponds to TH's Pat type. th-desugarCorresponds to TH's Exp type. Note that DLamE takes names, not patterns.) th-desugar(Guaranteed to be an instance declaration"&%$#'()*/.-,+012435<;:9876=?>@ABCEDFGHKJILMNORQPSdcba`_^]\[ZYXWVUTefghmlkjinopqrstvuwxyz|{}~,(C) 2016-2018 Daniel Wagner, 2019 Ryan ScottBSD-style (see LICENSE) Ryan Scott experimental non-portableNone 23567> | th-desugarAn ordered map whose , , , , , and  operations are biased towards leftmost indices when when breaking ties between keys. th-desugarThe value's index will be lower than the indices of the values in the OSet. th-desugarThe value's index will be higher than the indices of the values in the OSet.,(C) 2016-2018 Daniel Wagner, 2019 Ryan ScottBSD-style (see LICENSE) Ryan Scott experimental non-portableNone"7 th-desugarThe value's index will be lower than the indices of the values in the OSet. th-desugarThe value's index will be higher than the indices of the values in the OSet.,(C) 2016-2018 Daniel Wagner, 2019 Ryan ScottBSD-style (see LICENSE) Ryan Scott experimental non-portableNone37$ th-desugarAn ordered set whose , , , and  operations are biased towards leftmost indices when when breaking ties between keys. th-desugarThe element's index will be lower than the indices of the elements in the . th-desugarThe element's index will be higher than the indices of the elements in the . None% th-desugar Compute the free variables of a }. th-desugar&Extract the term variables bound by a . This does not8 extract any type variables bound by pattern signatures. None 3=2 th-desugar-An argument to a type, either a normal type (") or a visible kind application ().0 is useful when decomposing an application of a  to its arguments (e.g., in ). th-desugarA visible function argument type (i.e., one that must be supplied explicitly in the source code). This is in contrast to  invisible arguments (e.g., the c in c => r), which are instantiated without the need for explicit user input. th-desugar A visible forall (e.g.,  forall a -> a). th-desugar2An anonymous argument followed by an arrow (e.g., a -> r). th-desugar$The list of arguments in a function . th-desugarNo more arguments. th-desugar A series of forall+ed type variables followed by a dot (if ) or an arrow (if &). For example, the type variables  a1 ... an in forall a1 ... an. r. th-desugar-A series of constraint arguments followed by =>. For example, the  (c1, ..., cn) in (c1, ..., cn) => r. th-desugar=An anonymous argument followed by an arrow. For example, the a in a -> r. th-desugarThe type variable binders in a forall. This is not used by the TH AST itself, but this is used as an intermediate data type in . th-desugar A visible forall (e.g., forall a -> {...}). These do not have any notion of specificity, so we use () as a placeholder value in the s. th-desugar An invisible forall (e.g., forall a {b} c -> {...}), where each binder has a !. th-desugarLike newName, but even more unique (unique across different splices), and with unique nameBases. Precondition: the string is a valid Haskell alphanumeric identifier (could be upper- or lower-case). th-desugar$mkNameWith lookup_fun mkName_fun str looks up the exact  of str using the function  lookup_fun. If it finds  the , meaning that it is bound in the current scope, then it is returned. If it finds , it assumes that str. is declared in the current module, and uses  mkName_fun to construct the appropriate  to return. th-desugar Like TH's lookupTypeName, but if this name is not bound, then we assume it is declared in the current module. th-desugar Like TH's lookupDataName, but if this name is not bound, then we assume it is declared in the current module. th-desugar(Is this name a data constructor name? A  answer means "unsure". th-desugar8Extracts the name out of a variable pattern, or returns Nothing th-desugarExtracts the name out of a PlainTV , or returns Nothing th-desugar0Report that a certain TH construct is impossible th-desugar Convert a  into a /, dropping the kind signature (if it has one). th-desugar Convert a  into a 1, preserving the kind signature (if it has one). th-desugar Convert a  into a  (specifically, a 2), preserving the kind signature (if it has one). th-desugar!Do two names name the same thing? th-desugarExtract the degree of a tuple th-desugar"Extract the degree of a tuple name th-desugar$Extract the degree of an unboxed sum th-desugar)Extract the degree of an unboxed sum name th-desugar&Extract the degree of an unboxed tuple th-desugar+Extract the degree of an unboxed tuple name th-desugar6If the argument is a tuple type, return the components th-desugar5Filter the visible function arguments from a list of . th-desugarReconstruct an arrow $ from its argument and result types. th-desugarDecompose a function  into its arguments (the #) and its result type (the 'Type). th-desugar2Remove all of the explicit kind signatures from a . th-desugarDecompose an applied type into its individual components. For example, this: Proxy @Type Char would be unfolded to this: ( ''Proxy, [ ( ''Type),  ( ''Char)])  th-desugar Apply one  to a list of arguments. th-desugar0Filter the normal type arguments from a list of s. th-desugarExtract the underlying  or  from a . This forgets information about whether a type is a normal argument or not, so use with caution. th-desugar1Check if a name occurs anywhere within a TH tree. th-desugar)Extract all Names mentioned in a TH tree. th-desugarExtract the names bound in a Stmt th-desugarExtract the names bound in a Dec that could appear in a let expression. th-desugarExtract the names bound in a Pat th-desugar"Get an implicit param constraint ( IP name a", which is the desugared form of  (?name :: a)) from an explicit value.6This function is only available with GHC 8.0 or later. th-desugarConcatenate the result of a mapM th-desugarMonadic version of mapAccumL th-desugarSemi-shallow version of 3 - does not recurse into children of nodes of type a$ (only applies the handler to them).topEverywhereM (pure . fmap (*10) :: [Integer] -> Identity [Integer]) ([1,2,3] :: [Integer], "foo" :: String)Identity ([10,20,30],"foo")everywhereM (mkM (pure . fmap (*10) :: [Integer] -> Identity [Integer])) ([1,2,3] :: [Integer], "foo" :: String)Identity ([10,200,3000],"foo") th-desugarReturns  if the argument  is that of  (or * or  , to support older GHCs). th-desugarThe  of:  The kind , on GHC 8.0 or later. The kind * on older GHCs. th-desugarcombining function th-desugar initial state th-desugarinputs th-desugarfinal state, outputs=(C) 2018 Richard EisenbergBSD-style (see LICENSE) Ryan Scott experimental non-portableNoneCm th-desugarIgnore kind annotations in matchTy? th-desugar0A substitution is just a map from names to types th-desugar&Capture-avoiding substitution on types th-desugarComputes the union of two substitutions. Fails if both subsitutions map the same variable to different types. th-desugarmatchTy ign tmpl targ matches a type template tmpl against a type target targ. This returns a Map from names of type variables in the type template to types if the types indeed match up, or Nothing otherwise. In the Just case, it is guaranteed that every type variable mentioned in the template is mapped by the returned substitution.The first argument ign tells matchTy whether to ignore kind signatures in the template. A kind signature in the template might mean that a type variable has a more restrictive kind than otherwise possible, and that mapping that type variable to a type of a different kind could be disastrous. So, if we don't ignore kind signatures, this function returns Nothing if the template has a signature anywhere. If we do ignore kind signatures, it's possible the returned map will be ill-kinded. Use at your own risk.  NoneS th-desugar#A convenient implementation of the  class. Use by calling . th-desugarA  stores some list of declarations that should be considered in scope. # is the prototypical inhabitant of . th-desugar%Produce a list of local declarations. th-desugarLike reify from Template Haskell, but looks also in any not-yet-typechecked declarations. To establish this list of not-yet-typechecked declarations, use  . Returns  if reification fails. Note that no inferred type information is available from local declarations; bottoms may be used if necessary. th-desugarLike , but throws an exception upon failure, warning the user about separating splices. th-desugarReify a declaration, warning the user about splices if the reify fails. The warning says that reification can fail if you try to reify a type in the same splice as it is declared. th-desugar Extract the  TyVarBndrs and constructors given the Name of a type th-desugarFrom the name of a data constructor, retrive the datatype definition it is a part of. th-desugarFrom the name of a data constructor, retrieve its definition as a Con th-desugarAdd a list of declarations to be considered when reifying local declarations. th-desugarLook through a list of declarations and possibly return a relevant  th-desugarLook through a list of declarations and possibly return a fixity. th-desugarLike 1, but for fixities. Note that a return value of Nothing might mean that the name is not in scope, or it might mean that the name has no assigned fixity. (Use - if you really need to tell the difference.) th-desugarLike , but throws an exception upon failure, warning the user about separating splices. th-desugarLike 7 but for types and kinds. Note that a return value of Nothing might mean that the name is not in scope, or it might mean that the full type of the name cannot be determined. (Use , if you really need to tell the difference.) th-desugarLook through a list of declarations and return its full type, if available. th-desugarLike * from Template Haskell, but looks also in Names of not-yet-typechecked declarations. To establish this list of not-yet-typechecked declarations, use  . Returns . if no value with the same name can be found. th-desugarLike * from Template Haskell, but looks also in Names of not-yet-typechecked declarations. To establish this list of not-yet-typechecked declarations, use  . Returns - if no type with the same name can be found. th-desugar Like TH's lookupValueName, but if this name is not bound, then we assume it is declared in the current module.Unlike , this also consults the local declarations in scope when determining if the name is currently bound. th-desugar Like TH's lookupTypeName, but if this name is not bound, then we assume it is declared in the current module.Unlike , this also consults the local declarations in scope when determining if the name is currently bound. th-desugar Determines a 's  . If the  is attached to the - itself (i.e., it is unambiguous), then that  is immediately returned. Otherwise, reification is used to lookup up the . (consulting local declarations if necessary).Note that if a  lives in two different  NameSpaces- (which can genuinely happen--for instance,  "==", where == is both a function and a type family), then this function will simply return whichever = is discovered first via reification. If you wish to find a  in a particular  , use the  or  functions. th-desugarPrint this out on failure th-desugarName of the datatype (data or newtype ) of interestNone 38 th-desugarA visible function argument type (i.e., one that must be supplied explicitly in the source code). This is in contrast to  invisible arguments (e.g., the c in c => r), which are instantiated without the need for explicit user input. th-desugar A visible forall (e.g.,  forall a -> a). th-desugar2An anonymous argument followed by an arrow (e.g., a -> r). th-desugar$The list of arguments in a function }. th-desugarNo more arguments. th-desugar A series of forall+ed type variables followed by a dot (if ) or an arrow (if &). For example, the type variables  a1 ... an in forall a1 ... an. r. th-desugar-A series of constraint arguments followed by =>. For example, the  (c1, ..., cn) in (c1, ..., cn) => r. th-desugar=An anonymous argument followed by an arrow. For example, the a in a -> r. th-desugar-An argument to a type, either a normal type (") or a visible kind application ().! does not appear directly in the  th-desugar= AST, but it is useful when decomposing an application of a } to its arguments. th-desugarA backwards-compatible type synonym for the thing representing a single derived class in a deriving clause. (This is a  DerivClause, Pred, or Name depending on the GHC version.) th-desugarDesugaring a pattern also returns the list of variables bound in as-patterns and the values they should be bound to. This variables must be brought into scope in the "body" of the pattern. th-desugarDesugar an expression th-desugar.Desugar a tuple (or tuple section) expression. th-desugarConvert a list of  arguments and a  body into a . This is needed since  takes a list of &s for its bound variables instead of $s, so some reorganization is needed. th-desugar Desugar a list of matches for a case statement th-desugar Desugar a Body th-desugar,If decs is non-empty, delcare them in a let: th-desugarIf matches is non-empty, make a case statement; otherwise make an error statement th-desugarDesugar guarded expressions th-desugar Desugar the Stmt s in a guard th-desugar Desugar the Stmts in a do expression th-desugar Desugar the Stmt"s in a list or monad comprehension th-desugar?Desugar the contents of a parallel comprehension. Returns a Pat containing a tuple of all bound variables and an expression to produce the values for those variables th-desugarDesugar a pattern, along with processing a (desugared) expression that is the entire scope of the variables bound in the pattern. th-desugar Desugar multiple patterns. Like . th-desugarDesugar a pattern, returning a list of (Name, DExp) pairs of extra variables that must be bound within the scope of the pattern th-desugarDesugar a pattern. th-desugar Convert a  to a  . Fails on . th-desugarRemove all wildcards from a pattern, replacing any wildcard with a fresh variable th-desugarDesugar Info th-desugarDesugar arbitrary Decs th-desugarDesugar a single Dec, perhaps producing multiple Ss th-desugar Desugar a  or . th-desugar Desugar a  or a . th-desugar Desugar a FamilyResultSig th-desugar Desugar a TypeFamilyHead th-desugarDesugar Decs that can appear in a let( expression. See the documentation for 8 for an explanation of what the return type represents. th-desugarDesugar a single  that can appear in a let1 expression. This produces the following output: One or more h s (a single  can produce multiple hs in the event of a value declaration that binds multiple things by way of pattern matching.A function of type  -> , which should be applied to the expression immediately following the hs. This function prepends binding forms for any implicit params that were bound in the argument 7. (If no implicit params are bound, this is simply the  function.)!For instance, if the argument to  is the ?x = 42 part of this expression: let { ?x = 42 } in ?x Then the output is: let new_x_val = 42 \z ->  @"x" new_x_val zThis way, the expression let { new_x_val = 42 } in  @"x" new_x_val ( @"x") can be formed. The implicit param binders always come after all the other h4s to support parallel assignment of implicit params. th-desugarDesugar a single 9 corresponding to something that could appear after the let in a let: expression, but occurring at the top level. Because the  occurs at the top level, there is nothing that would correspond to the in ... part of the let expression. As a consequence, this function does not return a  ->  function corresonding to implicit param binders (these cannot occur at the top level). th-desugarDesugar a single Con.Because we always desugar Con-s to GADT syntax (see the documentation for F4), it is not always possible to desugar with just a ' alone. For instance, we must desugar: data Foo a = forall b. MkFoo b To this: ;data Foo a :: Type where MkFoo :: forall a b. b -> Foo a If our only argument was forall b. MkFoo b, it would be somewhat awkward to figure out (1) what the set of universally quantified type variables ([a]%) was, and (2) what the return type (Foo a) was. For this reason, we require passing these as arguments. (If we desugar an actual GADT constructor, these arguments are ignored.) th-desugar Desugar a BangType (or a  StrictType, if you're old-fashioned) th-desugar Desugar a  VarBangType (or a  VarStrictType, if you're old-fashioned) th-desugar Desugar a Foreign. th-desugar Desugar a Pragma. th-desugar Desugar a RuleBndr. th-desugar Desugar a TySynEqn . (Available only with GHC 7.8+)This requires a  as an argument since 2s did not have this information prior to GHC 8.8. th-desugar(Desugar clauses to a function definition th-desugarDesugar a type th-desugar Desugar a  with a particular flag. th-desugar Desugar a . th-desugar Desugar a . th-desugar Desugar a Cxt th-desugar Desugar a DerivingClause. th-desugar Desugar a  DerivStrategy. th-desugar Desugar a  PatSynDir . (Available only with GHC 8.2+) th-desugar Desugar a Pred , flattening any internal tuples th-desugar Desugar a quantified constraint. th-desugarLike , but safer and desugared. Uses local declarations where available. th-desugarLike , but safer and desugared. Uses local declarations where available. th-desugar Make a tuple  from a list of s. Avoids using a 1-tuple. th-desugar Make a tuple  from a list of s. Avoids using a 1-tuple. th-desugar Make a tuple  from a list of s. Avoids using a 1-tuple. th-desugar$Is this pattern guaranteed to match? th-desugar Apply one  to a list of arguments th-desugar Apply one } to a list of arguments th-desugar Desugar a . th-desugar0Filter the normal type arguments from a list of s. th-desugar Convert a t into a } th-desugarExtract the underlying } or y from a . This forgets information about whether a type is a normal argument or not, so use with caution. th-desugar Convert a  to a  in GHCs 7.x. This is just the identity operation in GHC 8.x, which has no :. (This is included in GHC 8.x only for good Haddocking.) th-desugarTake a list of }s, find their free variables, and sort them in reverse topological order to ensure that they are well scoped. In other words, the free variables are ordered such that: 0Whenever an explicit kind signature of the form (A :: K)+ is encountered, the free variables of K= will always appear to the left of the free variables of A in the returned result.The constraint in (1) notwithstanding, free variables will appear in left-to-right order of their original appearance.On older GHCs, this takes measures to avoid returning explicitly bound kind variables, which was not possible before  TypeInType. th-desugarReconstruct an arrow }$ from its argument and result types. th-desugarDecompose a function } into its arguments (the $) and its result type (the 'DType). th-desugar5Filter the visible function arguments from a list of . th-desugarDecompose an applied type into its individual components. For example, this: Proxy @Type Char would be unfolded to this: ( ''Proxy, [ ( ''Type),  ( ''Char)])  th-desugarExtract the kind from a t, if one is present. th-desugarSet the flag in a list of ts. This is often useful in contexts where one needs to re-use a list of ts from one flag setting to another flag setting. For example, in order to re-use the ts bound by a U in a ~, one can do the following:  case x of U _ _ _ tvbs _ _ _ -> ~ (| (   tvbs)) ...  th-desugarSome functions in this module only use certain arguments on particular versions of GHC. Other versions of GHC (that don't make use of those arguments) might need to conjure up those arguments out of thin air at the functions' call sites, so this function serves as a placeholder to use in those situations. (In other words, this is a slightly more informative version of .) th-desugar Compute the  of a tuple (boxed or unboxed) data constructor from its arity. th-desugarThe tuple's subexpressions. 3 entries denote empty fields in a tuple section. th-desugar/Name of the scrutinee, which must be a bare var th-desugarMatches of the case statement th-desugarbody to desugar th-desugar"where" declarations th-desugar$what to do if the guards don't match th-desugarGuarded expressions th-desugar&What to do if none of the guards match th-desugarThe Stmt s to desugar th-desugarWhat to do if the Stmts yield success th-desugarWhat to do if the Stmts yield failure th-desugarThe universally quantified type variables (used if desugaring a non-GADT constructor). th-desugarThe original data declaration's type (used if desugaring a non-GADT constructor). th-desugarName of the function th-desugarClauses to desugar th-desugar6The name of the constructor (used for error reporting)(C) 2014 Richard EisenbergBSD-style (see LICENSE) Ryan Scott experimental non-portableNone th-desugarThis returns a list of Decs because GHC 7.6.3 does not have a one-to-one mapping between S and Dec. th-desugar Sweeten a h.None> th-desugarRemove all nested pattern-matches within this expression. This also removes all DTildePas and DBangPas. After this is run, every pattern is guaranteed to be either a DConPa& with bare variables as arguments, a DLitPa, or a DWildPa. th-desugarLike  , but for a h.(C) 2014 Richard EisenbergBSD-style (see LICENSE) Ryan Scott experimental non-portableNone th-desugarExpands all type synonyms in a desugared type. Also expands open type family applications. (In GHCs before 7.10, this part does not work if there are any variables.) Attempts to expand closed type family applications, but aborts the moment it spots anything strange, like a nested type family application or type variable. th-desugarExpand all type synonyms and type families in the desugared abstract syntax tree provided, where type family simplification is on a "best effort" basis. Normally, the first parameter should have a type like  or h. th-desugarExpand all type synonyms and type families in the desugared abstract syntax tree provided, where type family simplification is on a "better than best effort" basis. This means that it will try so hard that it will sometimes do the wrong thing. Specifically, any kind parameters to type families are ignored. So, if we have /type family F (x :: k) where F (a :: *) = Int will expand F 'True to Int, ignoring that the expansion should only work for type of kind *.*This function is useful because plain old  will simply fail to expand type families that make use of kinds. Sometimes, the kinds are benign and we want to expand anyway. Use this function in that case.(C) 2014 Richard EisenbergBSD-style (see LICENSE) Ryan Scott experimental non-portableNone >  th-desugarThis class relates a TH type with its th-desugar type and allows conversions back and forth. The functional dependency goes only one way because we define the following instances on old versions of GHC:  instance   s instance   r Prior to GHC 9.0,  and  are simply type synonyms for , so making the functional dependencies bidirectional would cause these instances to be rejected. th-desugar"If the declaration passed in is a j6, creates new, equivalent declarations such that the  in all js is just a plain DVarPa. Other declarations are passed through unchanged. Note that the declarations that come out of this function are rather less efficient than those that come in: they have many more pattern matches. th-desugar Produces hs representing the record selector functions from the provided Fs.Note that if the same record selector appears in multiple constructors,  will return only one binding for that selector. For example, if you had: -data X = X1 {y :: Symbol} | X2 {y :: Symbol}  Then calling  on [X1, X2] will return: [ DSigD y (DAppT (DAppT DArrowT (DConT X)) (DConT Symbol)) , DFunD y [ DClause [DConP X1 [DVarP field]] (DVarE field) , DClause [DConP X2 [DVarP field]] (DVarE field) ] ] %instead of returning one binding for X1 and another binding for X2. does not attempt to filter out "naughty" record selectors@that is, records whose field types mention existentially quantified type variables that do not appear in the constructor's return type. Here is an example of a naughty record selector: data Some :: (Type -> Type) -> Type where MkSome :: { getSome :: f a } -> Some f %GHC itself will not allow the use of getSome* as a top-level function due to its type f a% mentioning the existential variable a, but  will return it nonetheless. Ultimately, this design choice is a practical one, as detecting which type variables are existential in Template Haskell is difficult in the general case. th-desugarCreate new kind variable binder names corresponding to the return kind of a data type. This is useful when you have a data type like: 2data Foo :: forall k. k -> Type -> Type where ... -But you want to be able to refer to the type Foo a b.  will take the kind forall k. k -> Type -> Type, discover that is has two visible argument kinds, and return as a result two new kind variable binders [a :: k, b :: Type], where a and b are fresh type variable names.(This expands kind synonyms if necessary. th-desugar This instance monomorphizes the flag parameter of t- since pre-9.0 versions of GHC do not equip  with a flag> type parameter. There is also a corresponding instance for /s. th-desugar This instance monomorphizes the flag parameter of t- since pre-9.0 versions of GHC do not equip  with a flag> type parameter. There is also a corresponding instance for /r.  ! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdegfhijklmnopqrstuvwxyz{|}~hijklm}~z{|ywxtuvsr! pqnoSTUVWXYZ[\]^_`abcd'("#$%&OPQRNegfLMHIJKFGCDEBA@ =>?56789:;<23401*+,-./) (C) 2014 Richard EisenbergBSD-style (see LICENSE) Ryan Scott experimental non-portableNoneX !"#$%&'(()*+,-./01234235236 7 8 9 : ; < < = > ? @ A B C D D E F G H I J K L M N O P Q R S T U V W X Y Y Z [ \ ] ^ ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x e y z { | } ~ ~                                                                                                          2323&th-desugar-1.13-JiutBfeADuYKO5U8kcplytLanguage.Haskell.TH.Desugar Language.Haskell.TH.Desugar.OMap'Language.Haskell.TH.Desugar.OMap.Strict Language.Haskell.TH.Desugar.OSet!Language.Haskell.TH.Desugar.Subst#Language.Haskell.TH.Desugar.Sweeten"Language.Haskell.TH.Desugar.Expand Language.Haskell.TH.Desugar.LiftLanguage.Haskell.TH.Desugar.ASTLanguage.Haskell.TH.Desugar.FV Language.Haskell.TH.Desugar.UtilKind★!Language.Haskell.TH.Desugar.Reify Language.Haskell.TH.Desugar.Core!Language.Haskell.TH.Desugar.Matchtemplate-haskellLanguage.Haskell.TH.SyntaxInjectivityAnnOverlap Overlappable OverlappingOverlaps Incoherent/ordered-containers-0.2.2-GyU6swLq6k0DcCVw8rbPro Data.Map.UtilIndexValueAnnotationTypeAnnotationModuleAnnotation AnnTarget SourceUnpackSourceNoUnpackNoSourceUnpackednessSourceUnpackedness SourceStrict SourceLazyNoSourceStrictnessSourceStrictnessBang RecordPatSyn InfixPatSyn PrefixPatSyn PatSynArgsInferRPhantomRRepresentationalRNominalRRole-th-abstraction-0.4.3.0-2bR6PShrhI5Ky9S2fwQwaC&Language.Haskell.TH.Datatype.TyVarBndr InferredSpec SpecifiedSpec SpecificityDDerivStrategyDStockStrategyDAnyclassStrategyDNewtypeStrategy DViaStrategy DDerivClause DInstanceDecDInfoDTyConIDVarIDTyVarI DPrimTyConIDPatSynI DTySynEqn DRuleBndrDRuleVar DTypedRuleVarDPragmaDInlineP DSpecialisePDSpecialiseInstPDRulePDAnnPDLineP DCompletePDForeignDImportFDExportF DVarBangType DBangTypeDDeclaredInfix DConFieldsDNormalCDRecCDConDFamilyResultSigDNoSigDKindSig DTyVarSigDTypeFamilyHead DPatSynType DPatSynDirDUnidir DImplBidir DExplBidirDDecDLetDecDDataDDTySynDDClassD DInstanceD DForeignDDOpenTypeFamilyDDClosedTypeFamilyD DDataFamilyD DDataInstD DTySynInstD DRoleAnnotDDStandaloneDerivD DDefaultSigDDPatSynD DPatSynSigDDKiSigD NewOrDataNewtypeDataDFunDDValDDSigDDInfixDDPragmaDDClauseDMatchDTyVarBndrUnitDTyVarBndrSpec DTyVarBndrDPlainTV DKindedTVDCxtDPredDKindDForallTelescope DForallVis DForallInvisDTypeDForallT DConstrainedTDAppT DAppKindTDSigTDVarTDConTDArrowTDLitT DWildCardTDPatDLitPDVarPDConPDTildePDBangPDSigPDWildPDExpDVarEDConEDLitEDAppE DAppTypeEDLamEDCaseEDLetEDSigEDStaticEOMapempty singleton insertPre insertPostunion unionWithKeydelete filterWithKey\\ intersectionintersectionWithKeynullsizemember notMemberlookup lookupIndexlookupAtfromListassocs toAscListtoMap $fMonoidOMap$fSemigroupOMap $fDataOMap$fFoldableOMap $fFunctorOMap$fEqOMap $fOrdOMap $fReadOMap $fShowOMap$fTraversableOMapOSetfiltertoSet$fSemigroupOSet $fDataOSet$fFoldableOSet$fEqOSet $fMonoidOSet $fOrdOSet $fReadOSet $fShowOSetfvDTypeextractBoundNamesDPatTypeArgTANormalTyArg VisFunArgVisFADep VisFAAnonFunArgsFANil FAForallsFACxtFAAnonForallTelescope ForallVis ForallInvis newUniqueName mkTypeName mkDataNametupleDegree_maybetupleNameDegree_maybeunboxedSumDegree_maybeunboxedSumNameDegree_maybeunboxedTupleDegree_maybeunboxedTupleNameDegree_maybefilterVisFunArgs ravelType unravelType unfoldType applyTypefilterTANormals nameOccursIn allNamesInextractBoundNamesStmtextractBoundNamesDecextractBoundNamesPatbindIPisTypeKindName typeKindName IgnoreKinds YesIgnoreNoIgnoreDSubstsubstTysubstForallTelescopesubstTyVarBndrs unionSubstsmatchTyunionMaybeSubstsDsMDsMonadlocalDeclarationsreifyWithLocals_maybereifyWithLocalsreifyWithWarninggetDataDdataConNameToDataNamedataConNameToConwithLocalDeclarationsreifyFixityWithLocalsreifyTypeWithLocalsreifyTypeWithLocals_maybelookupValueNameWithLocalslookupTypeNameWithLocalsmkDataNameWithLocalsmkTypeNameWithLocalsreifyNameSpace DVisFunArg DVisFADep DVisFAAnonDFunArgsDFANil DFAForallsDFACxtDFAAnonDTypeArg DTANormalDTyArgDerivingClausePatMdsExpmkDLamEFromDPats dsMatchesdsBody maybeDLetE maybeDCaseEdsGuards dsDoStmtsdsComp dsPatOverExp dsPatsOverExpdsPatXdsPat dPatToDExp removeWildsdsInfodsDecsdsDec dsDataDec dsDataInstDecdsFamilyResultSigdsTypeFamilyHead dsLetDecsdsLetDecdsCon dsBangType dsVarBangType dsForeigndsPragma dsRuleBndr dsClausesdsTypedsTvb dsTvbSpec dsTvbUnitdsCxt dsDerivClause dsPatSynDirdsPreddsReify dsReifyType mkTupleDExp mkTupleDPat applyDExp applyDType dsTypeArgfilterDTANormalsdTyVarBndrToDType strictToBangtoposortTyVarsOf ravelDType unravelDTypefilterDVisFunArgs unfoldDTypechangeDTVFlagsexpToTH matchToTHpatToTHdecsToTHdecToTH letDecToTHconToTH foreignToTH pragmaToTH ruleBndrToTH clauseToTHtypeToTHtvbToTHcxtToTHderivClauseToTH patSynDirToTHpredToTH typeArgToTHscExpscLetDec expandTypeexpandexpandUnsoundlyDesugardesugarsweeten flattenDValDgetRecordSelectorsmkExtraDKindBinders$fDesugarTypeArgDTypeArg $fDesugar[][]$fDesugarTyVarBndrDTyVarBndr$fDesugarTyVarBndrDTyVarBndr0$fDesugar[][]0$fDesugarTypeDType$fDesugarExpDExp$fLiftLiftedRepForallTelescope$fLiftLiftedRepDVisFunArg$fLiftLiftedRepVisFunArg$fLiftLiftedRepDFunArgs$fLiftLiftedRepFunArgs$fLiftLiftedRepDTypeArg$fLiftLiftedRepTypeArg$fLiftLiftedRepSpecificity$fLiftLiftedRepDFamilyResultSig$fLiftLiftedRepDTypeFamilyHead$fLiftLiftedRepDDerivStrategy$fLiftLiftedRepNewOrData$fLiftLiftedRepDPatSynDir$fLiftLiftedRepDTySynEqn$fLiftLiftedRepDRuleBndr$fLiftLiftedRepDPragma$fLiftLiftedRepDForeign$fLiftLiftedRepDConFields$fLiftLiftedRepDCon$fLiftLiftedRepDDerivClause$fLiftLiftedRepDDec$fLiftLiftedRepDLetDec$fLiftLiftedRepDClause$fLiftLiftedRepDMatch$fLiftLiftedRepDTyVarBndr$fLiftLiftedRepDForallTelescope$fLiftLiftedRepDType$fLiftLiftedRepDPat$fLiftLiftedRepDExpghc-prim GHC.TypesTruebase GHC.GenericsInfixCon GHC.MaybeMaybeForallC TyVarBndrGadtCRecGadtCFamilyResultSigTypeFamilyHead PatSynType PatSynDirType mkNameWithNameJustNothing isDataNameFalsestripVarP_maybestripPlainTV_maybe impossible tvbToTypetvbToTypeWithSigtvbToTANormalWithSig nameMatchessplitTuple_maybe unSigTypeConTprobablyWrongUnTypeArg concatMapM mapAccumLMtopEverywhereM"syb-0.7.2.1-Czbkg4llxoF3iV8T4efNeoData.Generics.Schemes everywhereM splitAtListthdOf3liftFstliftSndthirdOf3 mapMaybeM expectJustM firstMatchisInfixDataCon reifyInDecsInforeifyFixityInDecsreifyTypeInDecslookupValueNamelookupTypeName NameSpacemkName reifyType reifyFixity qReifyFixity qReifyTypeds_tup dsGuardStmts dsParCompDataDNewtypeD DataInstD NewtypeInstDDecGHC.Baseid GHC.ClassesipdsTopLevelLetDec dsTySynEqnTySynEqn TyVarBndrSpec TyVarBndrUnitdsDerivStrategy dsForallPredreify mkTupleExpExpisUniversalPatternprobablyWrongUnDTypeArgStrictextractTvbKindunusedArgumentGHC.Err undefinedreorderFields'dsTupdsBindS mk_tuple_stmt mk_tuple_dpattypeFamilyHeadNamedsCon'mkDForallConstrainedT reorderFieldsreorderFieldsPatnonFamilyDataReturnTypedataFamInstReturnTypedataFamInstTvbsdtvbNamemk_qual_do_name