Hello community, here is the log from the commit of package ghc-haskell-tools-rewrite for openSUSE:Factory checked in at 2017-08-31 20:56:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-haskell-tools-rewrite (Old) and /work/SRC/openSUSE:Factory/.ghc-haskell-tools-rewrite.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ghc-haskell-tools-rewrite" Thu Aug 31 20:56:09 2017 rev:2 rq:513376 version:0.8.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-haskell-tools-rewrite/ghc-haskell-tools-rewrite.changes 2017-04-12 18:06:47.681889994 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-haskell-tools-rewrite.new/ghc-haskell-tools-rewrite.changes 2017-08-31 20:56:10.933787661 +0200 @@ -1,0 +2,5 @@ +Thu Jul 27 14:07:37 UTC 2017 - psimons@suse.com + +- Update to version 0.8.0.0. + +------------------------------------------------------------------- Old: ---- haskell-tools-rewrite-0.5.0.0.tar.gz New: ---- haskell-tools-rewrite-0.8.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-haskell-tools-rewrite.spec ++++++ --- /var/tmp/diff_new_pack.TeA7qa/_old 2017-08-31 20:56:11.645687635 +0200 +++ /var/tmp/diff_new_pack.TeA7qa/_new 2017-08-31 20:56:11.645687635 +0200 @@ -19,7 +19,7 @@ %global pkg_name haskell-tools-rewrite %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.5.0.0 +Version: 0.8.0.0 Release: 0 Summary: Facilities for generating new parts of the Haskell-Tools AST License: BSD-3-Clause ++++++ haskell-tools-rewrite-0.5.0.0.tar.gz -> haskell-tools-rewrite-0.8.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/ElementTypes.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/ElementTypes.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/ElementTypes.hs 2017-01-31 20:47:41.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/ElementTypes.hs 2017-05-03 22:13:56.000000000 +0200 @@ -2,8 +2,8 @@ import Language.Haskell.Tools.AST -type AnnList node dom = AnnListG node dom SrcTemplateStage -type AnnMaybe node dom = AnnMaybeG node dom SrcTemplateStage +type AnnList node dom = AnnListG node dom SrcTemplateStage +type AnnMaybe node dom = AnnMaybeG node dom SrcTemplateStage -- * Modules @@ -26,13 +26,13 @@ -- | Marks how related names will be imported or exported with a given name type SubSpec dom = Ann USubSpec dom SrcTemplateStage --- | Pragmas that must be used after the module head +-- | Pragmas that must be used after the module head type ModulePragma dom = Ann UModulePragma dom SrcTemplateStage --- | Pragmas that must be used before defining the module +-- | Pragmas that must be used before defining the module type FilePragma dom = Ann UFilePragma dom SrcTemplateStage --- | An import declaration: @import Module.Name@ +-- | An import declaration: @import Module.Name@ type ImportDecl dom = Ann UImportDecl dom SrcTemplateStage -- | Restriction on the imported names @@ -67,7 +67,7 @@ -- | The list of declarations that can appear in a typeclass type ClassBody dom = Ann UClassBody dom SrcTemplateStage --- | Members of a class declaration +-- | Members of a class declaration type ClassElement dom = Ann UClassElement dom SrcTemplateStage -- The declared (possibly parameterized) type (@ A x :+: B y @). @@ -88,10 +88,10 @@ -- | Marker for a field wildcard. Only needed to attach semantic information in a type-safe way. type FieldWildcard dom = Ann UFieldWildcard dom SrcTemplateStage --- | A list of functional dependencies: @ | a -> b, c -> d @ separated by commas +-- | A list of functional dependencies: @ | a -> b, c -> d @ separated by commas type FunDeps dom = Ann UFunDeps dom SrcTemplateStage --- | A functional dependency, given on the form @l1 ... ln -> r1 ... rn@ +-- | A functional dependency, given on the form @l1 ... ln -> r1 ... rn@ type FunDep dom = Ann UFunDep dom SrcTemplateStage -- | A constructor declaration for a datatype @@ -112,7 +112,7 @@ -- | The specification of the class instance declaration type InstanceHead dom = Ann UInstanceHead dom SrcTemplateStage --- | Overlap pragmas. Can be applied to class declarations and class instance declarations. +-- | Overlap pragmas. Can be applied to class declarations and class instance declarations. type OverlapPragma dom = Ann UOverlapPragma dom SrcTemplateStage -- | Type equations as found in closed type families (@ T A = S @) @@ -124,7 +124,10 @@ -- | A rewrite rule (@ "map/map" forall f g xs. map f (map g xs) = map (f.g) xs @) type Rule dom = Ann URule dom SrcTemplateStage --- | Annotation allows you to connect an expression to any declaration. +-- | A variable for a rewrite rule. With or without type signature. +type RuleVar dom = Ann URuleVar dom SrcTemplateStage + +-- | Annotation allows you to connect an expression to any declaration. type AnnotationSubject dom = Ann UAnnotationSubject dom SrcTemplateStage -- | Formulas of minimal annotations declaring which functions should be defined. @@ -177,7 +180,7 @@ -- | Value binding for top-level and local bindings type ValueBind dom = Ann UValueBind dom SrcTemplateStage --- | Clause of function binding +-- | Clause of function binding type Match dom = Ann UMatch dom SrcTemplateStage -- | Something on the left side of the match @@ -186,7 +189,7 @@ -- | Right hand side of a value binding (possible with guards): (@ = 3 @ or @ | x == 1 = 3; | otherwise = 4 @) type Rhs dom = Ann URhs dom SrcTemplateStage --- | A guarded right-hand side of a value binding (@ | x > 3 = 2 @) +-- | A guarded right-hand side of a value binding (@ | x > 3 = 2 @) type GuardedRhs dom = Ann UGuardedRhs dom SrcTemplateStage -- | Guards for value bindings and pattern matches (@ Just v <- x, v > 1 @) @@ -195,7 +198,7 @@ -- | Bindings that are enabled in local blocks (where or let). type LocalBind dom = Ann ULocalBind dom SrcTemplateStage --- | Local bindings attached to a declaration (@ where x = 42 @) +-- | Local bindings attached to a declaration (@ where x = 42 @) type LocalBinds dom = Ann ULocalBinds dom SrcTemplateStage -- | A fixity signature (@ infixl 5 +, - @). @@ -241,7 +244,7 @@ -- | Right hand side of a match (possible with guards): (@ -> 3 @ or @ | x == 1 -> 3; | otherwise -> 4 @) type CaseRhs dom = Ann UCaseRhs dom SrcTemplateStage --- | A guarded right-hand side of pattern matches binding (@ | x > 3 -> 2 @) +-- | A guarded right-hand side of pattern matches binding (@ | x > 3 -> 2 @) type GuardedCaseRhs dom = Ann UGuardedCaseRhs dom SrcTemplateStage -- | Field update expressions @@ -289,13 +292,13 @@ -- * Template Haskell --- | A template haskell splice +-- | A template haskell splice type Splice dom = Ann USplice dom SrcTemplateStage -- | Template Haskell bracket expressions type Bracket dom = Ann UBracket dom SrcTemplateStage --- | Template haskell quasi-quotation: @[quoter|str]@ +-- | Template haskell quasi-quotation: @[quoter|str]@ type QuasiQuote dom = Ann UQuasiQuote dom SrcTemplateStage -- * Literals @@ -315,7 +318,7 @@ -- Linear implicit parameter: @%x@. Non-linear implicit parameter: @?x@. type QualifiedName dom = Ann UQualifiedName dom SrcTemplateStage --- | Parts of a qualified name. +-- | Parts of a qualified name. type NamePart dom = Ann UNamePart dom SrcTemplateStage -- | Program elements formatted as string literals (import packages, pragma texts) @@ -381,6 +384,7 @@ type AssertionList dom = AnnList UAssertion dom type CompStmtList dom = AnnList UCompStmt dom type RuleList dom = AnnList URule dom +type RuleVarList dom = AnnList URuleVar dom type RoleList dom = AnnList URole dom type MinimalFormulaList dom = AnnList UMinimalFormula dom type FunDepList dom = AnnList UFunDep dom diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Binds.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Binds.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Binds.hs 2017-01-31 20:47:41.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Binds.hs 2017-05-03 22:13:56.000000000 +0200 @@ -29,10 +29,10 @@ mkFunctionBind' :: Name dom -> [([Pattern dom], Expr dom)] -> ValueBind dom mkFunctionBind' name matches = mkFunctionBind $ map (\(args, rhs) -> mkMatch (mkMatchLhs name args) (mkUnguardedRhs rhs) Nothing) matches --- | Creates a clause of function binding +-- | Creates a clause of function binding mkMatch :: MatchLhs dom -> Rhs dom -> Maybe (LocalBinds dom) -> Match dom -mkMatch lhs rhs locs - = mkAnn (child <> child <> child) +mkMatch lhs rhs locs + = mkAnn (child <> child <> child) $ UMatch lhs rhs (mkAnnMaybe (after " " opt) locs) -- | Creates a match lhs with the function name and parameter names (@ f a b @) @@ -41,12 +41,11 @@ -- | Creates an infix match lhs for an operator (@ a + b @) mkInfixLhs :: Pattern dom -> Operator dom -> Pattern dom -> [Pattern dom] -> MatchLhs dom -mkInfixLhs lhs op rhs pats +mkInfixLhs lhs op rhs pats = mkAnn (child <> child <> child <> child) $ UInfixLhs lhs op rhs (mkAnnList (after " " $ separatedBy " " list) pats) -- | Local bindings attached to a declaration (@ where x = 42 @) mkLocalBinds :: [LocalBind dom] -> MaybeLocalBinds dom --- TODO: make the indentation automatic mkLocalBinds = mkAnnMaybe (relativeIndented 2 $ after "\nwhere " opt) . Just . mkAnn child . ULocalBinds . mkAnnList (indented list) @@ -71,17 +70,17 @@ -- | Creates a left-associative fixity declaration (@ infixl 5 +, - @). mkInfixL :: Int -> Operator dom -> FixitySignature dom -mkInfixL prec op = mkAnn (child <> " " <> child <> " " <> child) +mkInfixL prec op = mkAnn (child <> " " <> child <> " " <> child) $ UFixitySignature (mkAnn "infixl" AssocLeft) (mkAnnMaybe opt $ Just $ mkAnn (fromString (show prec)) (Precedence prec)) (mkAnnList (separatedBy ", " list) [op]) -- | Creates a right-associative fixity declaration (@ infixr 5 +, - @). mkInfixR :: Int -> Operator dom -> FixitySignature dom -mkInfixR prec op = mkAnn (child <> " " <> child <> " " <> child) +mkInfixR prec op = mkAnn (child <> " " <> child <> " " <> child) $ UFixitySignature (mkAnn "infixr" AssocRight) (mkAnnMaybe opt $ Just $ mkAnn (fromString (show prec)) (Precedence prec)) (mkAnnList (separatedBy ", " list) [op]) -- | Creates a non-associative fixity declaration (@ infix 5 +, - @). mkInfix :: Int -> Operator dom -> FixitySignature dom -mkInfix prec op = mkAnn (child <> " " <> child <> " " <> child) +mkInfix prec op = mkAnn (child <> " " <> child <> " " <> child) $ UFixitySignature (mkAnn "infix" AssocNone) (mkAnnMaybe opt $ Just $ mkAnn (fromString (show prec)) (Precedence prec)) (mkAnnList (separatedBy ", " list) [op]) -- | Creates an unguarded right-hand-side (@ = 3 @) @@ -92,7 +91,7 @@ mkGuardedRhss :: [GuardedRhs dom] -> Rhs dom mkGuardedRhss = mkAnn child . UGuardedRhss . mkAnnList (indented list) --- | Creates a guarded right-hand side of a value binding (@ | x > 3 = 2 @) +-- | Creates a guarded right-hand side of a value binding (@ | x > 3 = 2 @) mkGuardedRhs :: [RhsGuard dom] -> Expr dom -> GuardedRhs dom mkGuardedRhs guards expr = mkAnn ("| " <> child <> " = " <> child) $ UGuardedRhs (mkAnnList (separatedBy ", " list) guards) expr diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Decls.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Decls.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Decls.hs 2017-01-31 20:47:41.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Decls.hs 2017-05-17 13:32:17.000000000 +0200 @@ -8,16 +8,16 @@ import Language.Haskell.Tools.AST import Language.Haskell.Tools.AST.ElementTypes -import Language.Haskell.Tools.AST.Gen.Utils (mkAnn, mkAnnList, mkAnnMaybe) +import Language.Haskell.Tools.AST.Gen.Utils import Language.Haskell.Tools.Transform -- | Creates a type synonym ( @type String = [Char]@ ) -mkTypeDecl :: DeclHead dom -> Type dom -> Decl dom +mkTypeDecl :: DeclHead dom -> Type dom -> Decl dom mkTypeDecl dh typ = mkAnn (child <> " :: " <> child) $ UTypeDecl dh typ -- | Creates a standalone deriving declaration (@ deriving instance X T @) mkStandaloneDeriving :: Maybe (OverlapPragma dom) -> InstanceRule dom -> Decl dom -mkStandaloneDeriving overlap instRule = mkAnn ("deriving instance" <> child <> child) +mkStandaloneDeriving overlap instRule = mkAnn ("deriving instance" <> child <> child) $ UDerivDecl (mkAnnMaybe (after " " opt) overlap) instRule -- | Creates a fixity declaration (@ infixl 5 +, - @) @@ -44,44 +44,45 @@ -- | Creates a data or newtype declaration. mkDataDecl :: DataOrNewtypeKeyword dom -> Maybe (Context dom) -> DeclHead dom -> [ConDecl dom] -> Maybe (Deriving dom) -> Decl dom -mkDataDecl keyw ctx dh cons derivs - = mkAnn (child <> " " <> child <> child <> child <> child) - $ UDataDecl keyw (mkAnnMaybe (after " " opt) ctx) dh +mkDataDecl keyw ctx dh cons derivs + = mkAnn (child <> " " <> child <> child <> child <> child) + $ UDataDecl keyw (mkAnnMaybe (after " " opt) ctx) dh (mkAnnList (after " = " $ separatedBy " | " list) cons) (mkAnnMaybe (after " deriving " opt) derivs) -- | Creates a GADT-style data or newtype declaration. mkGADTDataDecl :: DataOrNewtypeKeyword dom -> Maybe (Context dom) -> DeclHead dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Maybe (Deriving dom) -> Decl dom -mkGADTDataDecl keyw ctx dh kind cons derivs - = mkAnn (child <> " " <> child <> child <> child <> child <> child) - $ UGDataDecl keyw (mkAnnMaybe (after " " opt) ctx) dh - (mkAnnMaybe (after " " opt) kind) (mkAnnList (after " = " $ separatedBy " | " list) cons) +mkGADTDataDecl keyw ctx dh kind cons derivs + = mkAnn (child <> " " <> child <> child <> child <> child <> child) + $ UGDataDecl keyw (mkAnnMaybe (after " " opt) ctx) dh + (mkAnnMaybe (after " " opt) kind) (mkAnnList (after " = " $ separatedBy " | " list) cons) (mkAnnMaybe (after " deriving " opt) derivs) -- | Creates a GADT constructor declaration (@ D1 :: Int -> T String @) mkGadtConDecl :: [Name dom] -> Type dom -> GadtConDecl dom -mkGadtConDecl names typ = mkAnn (child <> " :: " <> child) $ UGadtConDecl (mkAnnList (separatedBy ", " list) names) - (mkAnn child $ UGadtNormalType typ) +mkGadtConDecl names typ + = mkAnn (child <> " :: " <> child <> child <> child) + $ UGadtConDecl (mkAnnList (separatedBy ", " list) names) emptyList noth (mkAnn child $ UGadtNormalType typ) -- | Creates a GADT constructor declaration with record syntax (@ D1 :: { val :: Int } -> T String @) mkGadtRecordConDecl :: [Name dom] -> [FieldDecl dom] -> Type dom -> GadtConDecl dom -mkGadtRecordConDecl names flds typ - = mkAnn (child <> " :: " <> child) $ UGadtConDecl (mkAnnList (separatedBy ", " list) names) - $ mkAnn (child <> " -> " <> child) +mkGadtRecordConDecl names flds typ + = mkAnn (child <> " :: " <> child <> child <> child) $ UGadtConDecl (mkAnnList (separatedBy ", " list) names) emptyList noth + $ mkAnn (child <> " -> " <> child) $ UGadtRecordType (mkAnnList (after "{ " $ separatedBy ", " $ followedBy " }" list) flds) typ -- | Creates an ordinary data constructor (@ C t1 t2 @) mkConDecl :: Name dom -> [Type dom] -> ConDecl dom -mkConDecl name args = mkAnn (child <> child) $ UConDecl name (mkAnnList (after " " $ separatedBy " " $ list) args) +mkConDecl name args = mkAnn (child <> child <> child <> child) $ UConDecl emptyList noth name (mkAnnList (after " " $ separatedBy " " $ list) args) -- | Creates a record data constructor (@ Point { x :: Double, y :: Double } @) mkRecordConDecl :: Name dom -> [FieldDecl dom] -> ConDecl dom -mkRecordConDecl name fields - = mkAnn (child <> " { " <> child <> " }") $ URecordDecl name (mkAnnList (separatedBy ", " list) fields) +mkRecordConDecl name fields + = mkAnn (child <> child <> child <> " { " <> child <> " }") $ URecordDecl emptyList noth name (mkAnnList (separatedBy ", " list) fields) -- | Creates an infix data constructor (@ t1 :+: t2 @) mkInfixConDecl :: Type dom -> Operator dom -> Type dom -> ConDecl dom -mkInfixConDecl lhs op rhs = mkAnn (child <> " " <> child <> " " <> child) $ UInfixConDecl lhs op rhs +mkInfixConDecl lhs op rhs = mkAnn (child <> child <> child <> " " <> child <> " " <> child) $ UInfixConDecl emptyList noth lhs op rhs -- | Creates a field declaration (@ fld :: Int @) for a constructor mkFieldDecl :: [Name dom] -> Type dom -> FieldDecl dom @@ -104,11 +105,11 @@ -- | Creates a type class declaration (@ class X a where f = ... @) mkClassDecl :: Maybe (Context dom) -> DeclHead dom -> [FunDep dom] -> Maybe (ClassBody dom) -> Decl dom -mkClassDecl ctx dh funDeps body +mkClassDecl ctx dh funDeps body = let fdeps = case funDeps of [] -> Nothing _ -> Just $ mkAnn child $ UFunDeps $ mkAnnList (separatedBy ", " list) funDeps - in mkAnn ("class " <> child <> child <> child <> child) - $ UClassDecl (mkAnnMaybe (followedBy " " opt) ctx) dh (mkAnnMaybe (after " | " opt) fdeps) (mkAnnMaybe opt body) + in mkAnn ("class " <> child <> child <> child <> child) + $ UClassDecl (mkAnnMaybe (followedBy " " opt) ctx) dh (mkAnnMaybe (after " | " opt) fdeps) (mkAnnMaybe opt body) -- | Creates the list of declarations that can appear in a typeclass mkClassBody :: [ClassElement dom] -> ClassBody dom @@ -122,11 +123,11 @@ mkClassElemDef :: ValueBind dom -> ClassElement dom mkClassElemDef = mkAnn child . UClsDef --- | Creates an associated type synonym in class: @ type T y :: * @ +-- | Creates an associated type synonym in class: @ type T y :: * @ mkClassElemTypeFam :: DeclHead dom -> Maybe (TypeFamilySpec dom) -> ClassElement dom mkClassElemTypeFam dh tfSpec = mkAnn ("type " <> child) $ UClsTypeFam (mkAnn (child <> child) $ UTypeFamily dh (mkAnnMaybe opt tfSpec)) --- | Creates an associated data synonym in class: @ data T y :: * @ +-- | Creates an associated data synonym in class: @ data T y :: * @ mkClassElemDataFam :: DeclHead dom -> Maybe (KindConstraint dom) -> ClassElement dom mkClassElemDataFam dh kind = mkAnn ("data " <> child) $ UClsTypeFam (mkAnn (child <> child) $ UDataFamily dh (mkAnnMaybe opt kind)) @@ -140,7 +141,7 @@ -- | Creates a functional dependency, given on the form @l1 ... ln -> r1 ... rn@ mkFunDep :: [Name dom] -> [Name dom] -> FunDep dom -mkFunDep lhss rhss = mkAnn (child <> " -> " <> child) +mkFunDep lhss rhss = mkAnn (child <> " -> " <> child) $ UFunDep (mkAnnList (separatedBy ", " list) lhss) (mkAnnList (separatedBy ", " list) rhss) -- | Minimal pragma: @ {-\# MINIMAL (==) | (/=) \#-} @ in a class @@ -183,12 +184,12 @@ -- | Creates a type class instance declaration (@ instance X T [where f = ...] @) mkInstanceDecl :: Maybe (OverlapPragma dom) -> InstanceRule dom -> Maybe (InstBody dom) -> Decl dom -mkInstanceDecl overlap instRule body = mkAnn ("instance " <> child <> child <> child) +mkInstanceDecl overlap instRule body = mkAnn ("instance " <> child <> child <> child) $ UInstDecl (mkAnnMaybe (after " " opt) overlap) instRule (mkAnnMaybe opt body) -- | The instance declaration rule, which is, roughly, the part of the instance declaration before the where keyword. mkInstanceRule :: Maybe (Context dom) -> InstanceHead dom -> InstanceRule dom -mkInstanceRule ctx ih +mkInstanceRule ctx ih = mkAnn (child <> child <> child) $ UInstanceRule (mkAnnMaybe (after " " opt) Nothing) (mkAnnMaybe (after " " opt) ctx) ih -- | Type or class name as a part of the instance declaration @@ -196,7 +197,7 @@ mkInstanceHead = mkAnn child . UInstanceHeadCon -- | Infix application of the type/class name to the left operand as a part of the instance declaration -mkInfixInstanceHead :: Type dom -> Name dom -> InstanceHead dom +mkInfixInstanceHead :: Type dom -> Operator dom -> InstanceHead dom mkInfixInstanceHead typ n = mkAnn (child <> child) $ UInstanceHeadInfix typ n -- | Parenthesized instance head as a part of the instance declaration @@ -225,17 +226,17 @@ -- | An associated data type implementation (@ data A X = C1 | C2 @) int a type class instance mkInstanceDataFamilyDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> [ConDecl dom] -> Maybe (Deriving dom) -> InstBodyDecl dom -mkInstanceDataFamilyDef keyw instRule cons derivs - = mkAnn (child <> " " <> child <> child <> child) - $ UInstBodyDataDecl keyw instRule (mkAnnList (after " = " $ separatedBy " | " list) cons) +mkInstanceDataFamilyDef keyw instRule cons derivs + = mkAnn (child <> " " <> child <> child <> child) + $ UInstBodyDataDecl keyw instRule (mkAnnList (after " = " $ separatedBy " | " list) cons) (mkAnnMaybe (after " deriving " opt) derivs) -- | An associated data type implemented using GADT style int a type class instance -mkInstanceDataFamilyGADTDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] +mkInstanceDataFamilyGADTDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Maybe (Deriving dom) -> InstBodyDecl dom -mkInstanceDataFamilyGADTDef keyw instRule kind cons derivs - = mkAnn (child <> " " <> child <> child <> child) - $ UInstBodyGadtDataDecl keyw instRule (mkAnnMaybe opt kind) (mkAnnList (after " = " $ separatedBy " | " list) cons) +mkInstanceDataFamilyGADTDef keyw instRule kind cons derivs + = mkAnn (child <> " " <> child <> child <> child) + $ UInstBodyGadtDataDecl keyw instRule (mkAnnMaybe opt kind) (mkAnnList (after " = " $ separatedBy " | " list) cons) (mkAnnMaybe (after " deriving " opt) derivs) -- | Specialize instance pragma (no phase selection is allowed) in a type class instance @@ -243,39 +244,39 @@ mkInstanceSpecializePragma = mkAnn ("{-# SPECIALIZE " <> child <> " #-}") . USpecializeInstance -- | @OVERLAP@ pragma for type instance definitions -mkEnableOverlap :: OverlapPragma dom +mkEnableOverlap :: OverlapPragma dom mkEnableOverlap = mkAnn "{-# OVERLAP #-}" UEnableOverlap -- | @NO_OVERLAP@ pragma for type instance definitions -mkDisableOverlap :: OverlapPragma dom +mkDisableOverlap :: OverlapPragma dom mkDisableOverlap = mkAnn "{-# NO_OVERLAP #-}" UDisableOverlap -- | @OVERLAPPABLE@ pragma for type instance definitions -mkOverlappable :: OverlapPragma dom +mkOverlappable :: OverlapPragma dom mkOverlappable = mkAnn "{-# OVERLAPPABLE #-}" UOverlappable -- | @OVERLAPPING@ pragma for type instance definitions -mkOverlapping :: OverlapPragma dom +mkOverlapping :: OverlapPragma dom mkOverlapping = mkAnn "{-# OVERLAPPING #-}" UOverlapping -- | @OVERLAPS@ pragma for type instance definitions -mkOverlaps :: OverlapPragma dom +mkOverlaps :: OverlapPragma dom mkOverlaps = mkAnn "{-# OVERLAPS #-}" UOverlaps -- | @INCOHERENT@ pragma for type instance definitions -mkIncoherentOverlap :: OverlapPragma dom +mkIncoherentOverlap :: OverlapPragma dom mkIncoherentOverlap = mkAnn "{-# INCOHERENT #-}" UIncoherentOverlap -- * Type roles -- | Creates a role annotations (@ type role Ptr representational @) mkRoleDecl :: QualifiedName dom -> [Role dom] -> Decl dom -mkRoleDecl name roles +mkRoleDecl name roles = mkAnn ("type role " <> child <> child) $ URoleDecl name $ mkAnnList (separatedBy " " $ after " " list) roles -- | Marks a given type parameter as @nominal@. mkNominalRole :: Role dom -mkNominalRole = mkAnn "nominal" UNominal +mkNominalRole = mkAnn "nominal" UNominal -- | Marks a given type parameter as @representational@. mkRepresentationalRole :: Role dom @@ -289,7 +290,7 @@ -- | Creates a foreign import (@ foreign import foo :: Int -> IO Int @) mkForeignImport :: CallConv dom -> Maybe (Safety dom) -> Name dom -> Type dom -> Decl dom -mkForeignImport cc safety name typ = mkAnn (child <> child <> " " <> child <> " :: " <> child) +mkForeignImport cc safety name typ = mkAnn (child <> child <> " " <> child <> " :: " <> child) $ UForeignImport cc (mkAnnMaybe (after " " opt) safety) name typ -- | Creates a foreign export (@ foreign export ccall foo :: Int -> IO Int @) @@ -310,7 +311,7 @@ -- | Specifies that the given foreign import is @unsafe@. mkUnsafe :: Safety dom -mkUnsafe = mkAnn "unsafe" UUnsafe +mkUnsafe = mkAnn "unsafe" UUnsafe -- * Type and data families @@ -319,11 +320,11 @@ mkTypeFamily dh famSpec = mkAnn child $ UTypeFamilyDecl (mkAnn (child <> child) $ UTypeFamily dh (mkAnnMaybe (after " " opt) famSpec)) -- | Creates a closed type family declaration ( @type family F x where F Int = (); F a = Int@ ) -mkClosedTypeFamily :: DeclHead dom -> Maybe (KindConstraint dom) -> [TypeEqn dom] -> Decl dom -mkClosedTypeFamily dh kind typeqs = mkAnn (child <> child <> " where " <> child) +mkClosedTypeFamily :: DeclHead dom -> Maybe (TypeFamilySpec dom) -> [TypeEqn dom] -> Decl dom +mkClosedTypeFamily dh kind typeqs = mkAnn (child <> child <> " where " <> child) $ UClosedTypeFamilyDecl dh (mkAnnMaybe (after " " opt) kind) (mkAnnList (indented list) typeqs) --- | Creates a data family declaration (@ data family A a :: * -> * @) +-- | Creates a data family declaration (@ data family A a :: * -> * @) mkDataFamily :: DeclHead dom -> Maybe (KindConstraint dom) -> Decl dom mkDataFamily dh kind = mkAnn child $ UTypeFamilyDecl (mkAnn (child <> child) $ UDataFamily dh (mkAnnMaybe (after " " opt) kind)) @@ -332,8 +333,8 @@ mkTypeFamilyKindSpec = mkAnn child . UTypeFamilyKind -- | Specifies the injectivity of a type family (@ = r | r -> a @) -mkTypeFamilyInjectivitySpec :: Name dom -> [Name dom] -> TypeFamilySpec dom -mkTypeFamilyInjectivitySpec res dependent +mkTypeFamilyInjectivitySpec :: TyVar dom -> [Name dom] -> TypeFamilySpec dom +mkTypeFamilyInjectivitySpec res dependent = mkAnn child (UTypeFamilyInjectivity $ mkAnn (child <> " -> " <> child) $ UInjectivityAnn res (mkAnnList (separatedBy " " list) dependent)) -- | Type equations as found in closed type families (@ T A = S @) @@ -346,22 +347,22 @@ -- | Creates a data instance declaration (@ data instance Fam T = Con1 | Con2 @) mkDataInstance :: DataOrNewtypeKeyword dom -> InstanceRule dom -> [ConDecl dom] -> Maybe (Deriving dom) -> Decl dom -mkDataInstance keyw instRule cons derivs - = mkAnn (child <> " instance " <> child <> " = " <> child <> child) - $ UDataInstDecl keyw instRule (mkAnnList (after " = " $ separatedBy " | " list) cons) +mkDataInstance keyw instRule cons derivs + = mkAnn (child <> " instance " <> child <> " = " <> child <> child) + $ UDataInstDecl keyw instRule (mkAnnList (after " = " $ separatedBy " | " list) cons) (mkAnnMaybe (after " deriving " opt) derivs) -- | Creates a GADT-style data instance declaration (@ data instance Fam T where ... @) mkGadtDataInstance :: DataOrNewtypeKeyword dom -> InstanceRule dom -> Maybe (KindConstraint dom) -> [GadtConDecl dom] -> Decl dom -mkGadtDataInstance keyw instRule kind cons - = mkAnn (child <> " instance " <> child <> child <> " where " <> child) +mkGadtDataInstance keyw instRule kind cons + = mkAnn (child <> " instance " <> child <> child <> " where " <> child) $ UGDataInstDecl keyw instRule (mkAnnMaybe (after " " opt) kind) (mkAnnList (indented list) cons) -- * Pattern synonyms -- | Creates a pattern synonym (@ pattern Arrow t1 t2 = App \"->\" [t1, t2] @) mkPatternSynonym :: PatSynLhs dom -> PatSynRhs dom -> Decl dom -mkPatternSynonym lhs rhs = mkAnn child $ UPatternSynonymDecl $ mkAnn ("pattern " <> child <> " " <> child) +mkPatternSynonym lhs rhs = mkAnn child $ UPatternSynonymDecl $ mkAnn ("pattern " <> child <> " " <> child) $ UPatternSynonym lhs rhs -- | Creates a left hand side of a pattern synonym with a constructor name and arguments (@ Arrow t1 t2 @) @@ -374,7 +375,7 @@ -- | Creates a record-style pattern synonym left-hand side (@ Arrow { arrowFrom, arrowTo } @) mkRecordPatSyn :: Name dom -> [Name dom] -> PatSynLhs dom -mkRecordPatSyn con args +mkRecordPatSyn con args = mkAnn (child <> child) $ URecordPatSyn con $ mkAnnList (after "{ " $ separatedBy ", " $ followedBy " }" list) args -- | Creates an automatically two-way pattern synonym (@ = App \"Int\" [] @) @@ -385,9 +386,9 @@ mkOneWayPatSyn :: Pattern dom -> PatSynRhs dom mkOneWayPatSyn = mkAnn ("<- " <> child) . UOneDirectionalPatSyn --- | Creates a pattern synonym with the other direction explicitely specified (@ <- App \"Int\" [] where Int = App \"Int\" [] @) +-- | Creates a pattern synonym with the other direction explicitly specified (@ <- App \"Int\" [] where Int = App \"Int\" [] @) mkTwoWayPatSyn :: Pattern dom -> [Match dom] -> PatSynRhs dom -mkTwoWayPatSyn pat match = mkAnn ("<- " <> child <> child) $ UBidirectionalPatSyn pat $ mkAnnMaybe (after " where " opt) +mkTwoWayPatSyn pat match = mkAnn ("<- " <> child <> child) $ UBidirectionalPatSyn pat $ mkAnnMaybe (after " where " opt) $ Just $ mkAnn child $ UPatSynWhere $ mkAnnList (indented list) match -- | Creates a pattern type signature declaration (@ pattern Succ :: Int -> Int @) @@ -409,13 +410,15 @@ -- | A pragma that marks definitions as deprecated (@ {-\# DEPRECATED f "f will be replaced by g" \#-} @) mkDeprPragma :: [Name dom] -> String -> TopLevelPragma dom -mkDeprPragma defs msg = mkAnn ("{-# DEPRECATED " <> child <> " " <> child <> " #-}") - $ UDeprPragma (mkAnnList (separatedBy ", " list) defs) $ mkAnn ("\"" <> child <> "\"") $ UStringNode msg +mkDeprPragma defs msg = mkAnn ("{-# DEPRECATED " <> child <> " " <> child <> " #-}") + $ UDeprPragma (mkAnnList (separatedBy ", " list) defs) + (mkAnnList (separatedBy ", " list) [mkAnn ("\"" <> child <> "\"") $ UStringNode msg]) -- | A pragma that marks definitions as deprecated (@ {-\# WARNING unsafePerformIO "you should know what you are doing" \#-} @) mkWarningPragma :: [Name dom] -> String -> TopLevelPragma dom -mkWarningPragma defs msg = mkAnn ("{-# WARNING " <> child <> " " <> child <> " #-}") - $ UWarningPragma (mkAnnList (separatedBy ", " list) defs) $ mkAnn ("\"" <> child <> "\"") $ UStringNode msg +mkWarningPragma defs msg = mkAnn ("{-# WARNING " <> child <> " " <> child <> " #-}") + $ UWarningPragma (mkAnnList (separatedBy ", " list) defs) + (mkAnnList (separatedBy ", " list) [mkAnn ("\"" <> child <> "\"") $ UStringNode msg]) -- | A pragma that annotates a definition with an arbitrary value (@ {-\# ANN f 42 \#-} @) mkAnnPragma :: AnnotationSubject dom -> Expr dom -> TopLevelPragma dom @@ -423,7 +426,7 @@ -- | A pragma that marks a function for inlining to the compiler (@ {-\# INLINE thenUs \#-} @) mkInlinePragma :: Maybe (ConlikeAnnot dom) -> Maybe (PhaseControl dom) -> Name dom -> TopLevelPragma dom -mkInlinePragma conlike phase name +mkInlinePragma conlike phase name = mkAnn ("{-# INLINE " <> child <> child <> child <> " #-}") $ UInlinePragmaDecl $ mkAnn child $ UInlinePragma (mkAnnMaybe (followedBy " " opt) conlike) (mkAnnMaybe (followedBy " " opt) phase) name @@ -440,33 +443,37 @@ -- | A pragma for maintaining line numbers in generated sources (@ {-\# LINE 123 "somefile" \#-} @) mkLinePragma :: Int -> Maybe (StringNode dom) -> TopLevelPragma dom -mkLinePragma line filename - = mkAnn ("{-# LINE " <> child <> child <> " #-}") +mkLinePragma line filename + = mkAnn ("{-# LINE " <> child <> child <> " #-}") $ ULinePragma (mkAnn child $ LineNumber line) (mkAnnMaybe (after " " opt) filename) -- | A pragma that tells the compiler that a polymorph function should be optimized for a given type (@ {-\# SPECIALISE f :: Int -> b -> b \#-} @) mkSpecializePragma :: Maybe (PhaseControl dom) -> Name dom -> [Type dom] -> TopLevelPragma dom -mkSpecializePragma phase def specTypes - = mkAnn ("{-# SPECIALIZE " <> child <> child <> " " <> child <> " #-}") - $ USpecializePragma (mkAnnMaybe (after " " opt) phase) def $ mkAnnList (separatedBy ", " list) specTypes +mkSpecializePragma phase def specTypes + = mkAnn child (USpecializeDecl + $ mkAnn ("{-# SPECIALIZE " <> child <> child <> " " <> child <> " #-}") + $ USpecializePragma (mkAnnMaybe (after " " opt) phase) def $ mkAnnList (separatedBy ", " list) specTypes) -- | Marks that the pragma should be applied from a given compile phase (@ [2] @) mkPhaseControlFrom :: Integer -> PhaseControl dom -mkPhaseControlFrom phaseNum - = mkAnn ("[" <> child <> child <> "]") $ UPhaseControl (mkAnnMaybe opt Nothing) (mkAnn child $ PhaseNumber phaseNum) +mkPhaseControlFrom phaseNum + = mkAnn ("[" <> child <> child <> "]") $ UPhaseControl (mkAnnMaybe opt Nothing) (mkAnnMaybe opt $ Just $ mkAnn child $ PhaseNumber phaseNum) -- | Marks that the pragma should be applied until a given compile phase (@ [~2] @) mkPhaseControlUntil :: Integer -> PhaseControl dom -mkPhaseControlUntil phaseNum - = mkAnn ("[" <> child <> child <> "]") $ UPhaseControl (mkAnnMaybe opt $ Just $ mkAnn "~" PhaseInvert) - (mkAnn child $ PhaseNumber phaseNum) +mkPhaseControlUntil phaseNum + = mkAnn ("[" <> child <> child <> "]") $ UPhaseControl (mkAnnMaybe opt $ Just $ mkAnn "~" PhaseInvert) + (mkAnnMaybe opt $ Just $ mkAnn child $ PhaseNumber phaseNum) -- | A rewrite rule (@ "map/map" forall f g xs. map f (map g xs) = map (f.g) xs @) -mkRewriteRule :: String -> Maybe (PhaseControl dom) -> [TyVar dom] -> Expr dom -> Expr dom -> Rule dom +mkRewriteRule :: String -> Maybe (PhaseControl dom) -> [RuleVar dom] -> Expr dom -> Expr dom -> Rule dom mkRewriteRule name phase vars lhs rhs = mkAnn (child <> " " <> child <> child <> child <> " = " <> child) $ URule (mkAnn ("\"" <> child <> "\"") $ UStringNode name) (mkAnnMaybe (followedBy " " opt) phase) - (mkAnnList (after "forall " $ separatedBy " " $ followedBy ". " list) vars) lhs rhs + (mkAnnList (after "forall " $ separatedBy " " $ followedBy ". " list) (vars)) lhs rhs + +mkRuleVar :: Name dom -> RuleVar dom +mkRuleVar name = mkAnn child (URuleVar name) -- | The definition with the given name is annotated mkNameAnnotation :: Name dom -> AnnotationSubject dom diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Types.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Types.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Gen/Types.hs 2017-01-31 20:47:42.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Gen/Types.hs 2017-05-03 22:13:56.000000000 +0200 @@ -2,7 +2,7 @@ -- The bindings defined here create a the annotated version of the AST constructor with the same name. -- For example, @mkTyForall@ creates the annotated version of the @TyForall@ AST constructor. {-# LANGUAGE OverloadedStrings - , TypeFamilies + , TypeFamilies #-} module Language.Haskell.Tools.AST.Gen.Types where @@ -56,7 +56,7 @@ -- | Infix type constructor (@ (a <: b) @) mkInfixTypeApp :: Type dom -> Operator dom -> Type dom -> Type dom mkInfixTypeApp left op right = mkAnn (child <> " " <> child <> " " <> child) (UTyInfix left op right) - + -- | Type surrounded by parentheses (@ (T a) @) mkParenType :: Type dom -> Type dom mkParenType = mkAnn ("(" <> child <> ")") . UTyParen @@ -124,27 +124,23 @@ -- | A list of elements as a kind. mkPromotedListType :: [Type dom] -> Type dom -mkPromotedListType +mkPromotedListType = mkAnn child . UTyPromoted . mkAnn ("[" <> child <> "]") . UPromotedList . mkAnnList (separatedBy ", " list) -- | A tuple of elements as a kind. mkPromotedTupleType :: [Type dom] -> Type dom -mkPromotedTupleType +mkPromotedTupleType = mkAnn child . UTyPromoted . mkAnn ("(" <> child <> ")") . UPromotedTuple . mkAnnList (separatedBy ", " list) --- | Kind of the unit value @()@. +-- | Kind of the unit value @()@. mkPromotedUnitType :: Type dom mkPromotedUnitType = mkAnn child $ UTyPromoted $ mkAnn "()" UPromotedUnit -- * Generation of contexts --- | Creates a context of one assertion (@ C a => ... @) -mkContextOne :: Assertion dom -> Context dom -mkContextOne = mkAnn (child <> " =>") . UContextOne - --- | Creates a context of a set of assertions (@ (C1 a, C2 b) => ... @, but can be one: @ (C a) => ... @) -mkContextMulti :: [Assertion dom] -> Context dom -mkContextMulti = mkAnn ("(" <> child <> ") =>") . UContextMulti . mkAnnList (separatedBy ", " list) +-- | Creates a context of assertions (@ C a => ... @) +mkContext :: Assertion dom -> Context dom +mkContext = mkAnn (child <> " =>") . UContext -- * Generation of assertions @@ -161,3 +157,6 @@ mkImplicitAssert :: Name dom -> Type dom -> Assertion dom mkImplicitAssert n t = mkAnn (child <> " :: " <> child) $ UImplicitAssert n t +-- | Creates a list of assertions (@ (Eq a, Show a) @) +mkTupleAssertion :: [Assertion dom] -> Assertion dom +mkTupleAssertion ass = mkAnn ("(" <> child <> ")") $ UTupleAssert $ mkAnnList (separatedBy ", " list) ass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Binds.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Binds.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Binds.hs 2017-01-31 20:47:42.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Binds.hs 2017-05-03 22:13:56.000000000 +0200 @@ -5,7 +5,7 @@ import Language.Haskell.Tools.AST import Language.Haskell.Tools.AST.ElementTypes --- | Non-function binding (@ v = "12" @) +-- | Non-function binding (@ v = "12" @) pattern SimpleBind :: Pattern dom -> Rhs dom -> MaybeLocalBinds dom -> ValueBind dom pattern SimpleBind p r l <- Ann _ (USimpleBind p r l) @@ -13,7 +13,7 @@ pattern FunctionBind :: MatchList dom -> ValueBind dom pattern FunctionBind matches <- Ann _ (UFunBind matches) --- | Clause of function binding +-- | Clause of function binding pattern Match :: MatchLhs dom -> Rhs dom -> MaybeLocalBinds dom -> Match dom pattern Match lhs rhs locs <- Ann _ (UMatch lhs rhs locs) @@ -45,8 +45,6 @@ pattern TypeSignature :: NameList dom -> Type dom -> TypeSignature dom pattern TypeSignature n t <- Ann _ (UTypeSignature n t) --- TODO: match precedence with maybe - -- | A left-associative fixity declaration (@ infixl 5 +, - @). pattern InfixL :: OperatorList dom -> FixitySignature dom pattern InfixL op <- Ann _ (UFixitySignature (Ann _ AssocLeft) _ op) @@ -67,7 +65,7 @@ pattern GuardedRhss :: GuardedRhsList dom -> Rhs dom pattern GuardedRhss rhss <- Ann _ (UGuardedRhss rhss) --- | A guarded right-hand side of a value binding (@ | x > 3 = 2 @) +-- | A guarded right-hand side of a value binding (@ | x > 3 = 2 @) pattern GuardedRhs :: RhsGuardList dom -> Expr dom -> GuardedRhs dom pattern GuardedRhs guards expr <- Ann _ (UGuardedRhs guards expr) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Decls.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Decls.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Decls.hs 2017-01-31 20:47:42.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Decls.hs 2017-05-17 13:32:17.000000000 +0200 @@ -10,7 +10,7 @@ -- * Declarations -- | A type synonym ( @type String = [Char]@ ) -pattern TypeDecl :: DeclHead dom -> Type dom -> Decl dom +pattern TypeDecl :: DeclHead dom -> Type dom -> Decl dom pattern TypeDecl dh typ <- Ann _ (UTypeDecl dh typ) -- | Standalone deriving declaration (@ deriving instance X T @) @@ -39,7 +39,7 @@ -- * Data type definitions --- | A data or newtype declaration. Empty data type declarations without +-- | A data or newtype declaration. Empty data type declarations without -- where keyword are always belong to DataDecl. pattern DataDecl :: DataOrNewtypeKeyword dom -> MaybeContext dom -> DeclHead dom -> ConDeclList dom -> MaybeDeriving dom -> Decl dom pattern DataDecl keyw ctx dh cons derivs <- Ann _ (UDataDecl keyw ctx dh cons derivs) @@ -50,23 +50,23 @@ -- | GADT constructor declaration (@ D1 :: Int -> T String @) pattern GadtConDecl :: NameList dom -> Type dom -> GadtConDecl dom -pattern GadtConDecl names typ <- Ann _ (UGadtConDecl names (Ann _ (UGadtNormalType typ))) +pattern GadtConDecl names typ <- Ann _ (UGadtConDecl names _ _ (Ann _ (UGadtNormalType typ))) -- | GADT constructor declaration with record syntax (@ D1 :: { val :: Int } -> T String @) pattern GadtRecordConDecl :: NameList dom -> FieldDeclList dom -> Type dom -> GadtConDecl dom -pattern GadtRecordConDecl names fields typ <- Ann _ (UGadtConDecl names (Ann _ (UGadtRecordType fields typ))) +pattern GadtRecordConDecl names fields typ <- Ann _ (UGadtConDecl names _ _ (Ann _ (UGadtRecordType fields typ))) -- | Ordinary data constructor (@ C t1 t2 @) pattern ConDecl :: Name dom -> TypeList dom -> ConDecl dom -pattern ConDecl name args <- Ann _ (UConDecl name args) +pattern ConDecl name args <- Ann _ (UConDecl _ _ name args) -- | Creates a record data constructor (@ Point { x :: Double, y :: Double } @) pattern RecordConDecl :: Name dom -> FieldDeclList dom -> ConDecl dom -pattern RecordConDecl name fields <- Ann _ (URecordDecl name fields) +pattern RecordConDecl name fields <- Ann _ (URecordDecl _ _ name fields) -- | Infix data constructor (@ t1 :+: t2 @) pattern InfixConDecl :: Type dom -> Operator dom -> Type dom -> ConDecl dom -pattern InfixConDecl lhs op rhs <- Ann _ (UInfixConDecl lhs op rhs) +pattern InfixConDecl lhs op rhs <- Ann _ (UInfixConDecl _ _ lhs op rhs) -- | Field declaration (@ fld :: Int @) pattern FieldDecl :: NameList dom -> Type dom -> FieldDecl dom @@ -86,11 +86,11 @@ pattern NewtypeKeyword :: DataOrNewtypeKeyword dom pattern NewtypeKeyword <- Ann _ UNewtypeKeyword --- | A list of functional dependencies: @ | a -> b, c -> d @ separated by commas +-- | A list of functional dependencies: @ | a -> b, c -> d @ separated by commas pattern FunDeps :: FunDepList dom -> FunDeps dom pattern FunDeps fds <- Ann _ (UFunDeps fds) --- | A functional dependency, given on the form @l1 ... ln -> r1 ... rn@ +-- | A functional dependency, given on the form @l1 ... ln -> r1 ... rn@ pattern FunDep :: NameList dom -> NameList dom -> FunDep dom pattern FunDep lhs rhs <- Ann _ (UFunDep lhs rhs) @@ -191,7 +191,7 @@ pattern InstanceDataFamilyDef keyw instRule cons derivs <- Ann _ (UInstBodyDataDecl keyw instRule cons derivs ) -- | An associated data definition as a GADT (@ data A X where B :: Int -> A X @) in a class instance -pattern InstanceDataFamilyGADTDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> MaybeKindConstraint dome -> AnnListG UGadtConDecl dom stage +pattern InstanceDataFamilyGADTDef :: DataOrNewtypeKeyword dom -> InstanceRule dom -> MaybeKindConstraint dome -> AnnListG UGadtConDecl dom stage -> MaybeDeriving dom -> InstBodyDecl dom pattern InstanceDataFamilyGADTDef keyw instRule kind cons derivs <- Ann _ (UInstBodyGadtDataDecl keyw instRule kind cons derivs) @@ -208,40 +208,40 @@ pattern InstanceHead name <- Ann _ (UInstanceHeadCon name) -- | Infix application of the type/class name to the left operand as an instance head -pattern InfixInstanceHead :: Type dom -> Name dom -> InstanceHead dom +pattern InfixInstanceHead :: Type dom -> Operator dom -> InstanceHead dom pattern InfixInstanceHead typ n <- Ann _ (UInstanceHeadInfix typ n) -- | Parenthesized instance head pattern ParenInstanceHead :: InstanceHead dom -> InstanceHead dom pattern ParenInstanceHead ih <- Ann _ (UInstanceHeadParen ih) --- | Type application as an instance head +-- | Type application as an instance head pattern AppInstanceHead :: InstanceHead dom -> Type dom -> InstanceHead dom pattern AppInstanceHead fun arg <- Ann _ (UInstanceHeadApp fun arg) -- | @OVERLAP@ pragma -pattern EnableOverlap :: OverlapPragma dom -pattern EnableOverlap <- Ann _ UEnableOverlap +pattern EnableOverlap :: OverlapPragma dom +pattern EnableOverlap <- Ann _ UEnableOverlap -- | @NO_OVERLAP@ pragma -pattern DisableOverlap :: OverlapPragma dom -pattern DisableOverlap <- Ann _ UDisableOverlap +pattern DisableOverlap :: OverlapPragma dom +pattern DisableOverlap <- Ann _ UDisableOverlap -- | @OVERLAPPABLE@ pragma -pattern Overlappable :: OverlapPragma dom -pattern Overlappable <- Ann _ UOverlappable +pattern Overlappable :: OverlapPragma dom +pattern Overlappable <- Ann _ UOverlappable -- | @OVERLAPPING@ pragma -pattern Overlapping :: OverlapPragma dom -pattern Overlapping <- Ann _ UOverlapping +pattern Overlapping :: OverlapPragma dom +pattern Overlapping <- Ann _ UOverlapping -- | @OVERLAPS@ pragma -pattern Overlaps :: OverlapPragma dom -pattern Overlaps <- Ann _ UOverlaps +pattern Overlaps :: OverlapPragma dom +pattern Overlaps <- Ann _ UOverlaps -- | @INCOHERENT@ pragma -pattern IncoherentOverlap :: OverlapPragma dom -pattern IncoherentOverlap <- Ann _ UIncoherentOverlap +pattern IncoherentOverlap :: OverlapPragma dom +pattern IncoherentOverlap <- Ann _ UIncoherentOverlap -- * Type roles @@ -282,7 +282,7 @@ -- | Specifies that the given foreign import is @unsafe@. pattern Unsafe :: Safety dom -pattern Unsafe <- Ann _ UUnsafe +pattern Unsafe <- Ann _ UUnsafe -- * Pattern synonyms @@ -310,7 +310,7 @@ pattern OneWayPatSyn :: Pattern dom -> PatSynRhs dom pattern OneWayPatSyn pat <- Ann _ (UOneDirectionalPatSyn pat) --- | A pattern synonym with the other direction explicitely specified (@ <- App \"Int\" [] where Int = App \"Int\" [] @) +-- | A pattern synonym with the other direction explicitly specified (@ <- App \"Int\" [] where Int = App \"Int\" [] @) pattern TwoWayPatSyn :: Pattern dom -> MatchList dom -> PatSynRhs dom pattern TwoWayPatSyn pat match <- Ann _ (UBidirectionalPatSyn pat (AnnJust (Ann _ (UPatSynWhere match)))) @@ -344,7 +344,7 @@ pattern GadtDataInstance keyw instRule kind cons <- Ann _ (UGDataInstDecl keyw instRule kind cons ) -- | A closed type family declaration -pattern ClosedTypeFamily :: DeclHead dom -> MaybeKindConstraint dom -> TypeEqnList dom -> Decl dom +pattern ClosedTypeFamily :: DeclHead dom -> MaybeTypeFamilySpec dom -> TypeEqnList dom -> Decl dom pattern ClosedTypeFamily dh kind typeqs <- Ann _ (UClosedTypeFamilyDecl dh kind typeqs) -- | Specifies the kind of a type family (@ :: * -> * @) @@ -352,7 +352,7 @@ pattern TypeFamilyKindSpec kind <- Ann _ (UTypeFamilyKind kind) -- | Specifies the injectivity of a type family (@ = r | r -> a @) -pattern TypeFamilyInjectivitySpec :: Name dom -> NameList dom -> TypeFamilySpec dom +pattern TypeFamilyInjectivitySpec :: TyVar dom -> NameList dom -> TypeFamilySpec dom pattern TypeFamilyInjectivitySpec res dependent <- Ann _ (UTypeFamilyInjectivity (Ann _ (UInjectivityAnn res dependent))) -- | Type equations as found in closed type families (@ T A = S @) @@ -371,11 +371,11 @@ -- | A pragma that marks definitions as deprecated (@ {-\# DEPRECATED f "f will be replaced by g" \#-} @) pattern DeprPragma :: NameList dom -> String -> TopLevelPragma dom -pattern DeprPragma defs msg <- Ann _ (UDeprPragma defs (Ann _ (UStringNode msg))) +pattern DeprPragma defs msg <- Ann _ (UDeprPragma defs (AnnList [Ann _ (UStringNode msg)])) -- | A pragma that marks definitions as deprecated (@ {-\# WARNING unsafePerformIO "you should know what you are doing" \#-} @) pattern WarningPragma :: NameList dom -> String -> TopLevelPragma dom -pattern WarningPragma defs msg <- Ann _ (UWarningPragma defs (Ann _ (UStringNode msg))) +pattern WarningPragma defs msg <- Ann _ (UWarningPragma defs (AnnList [Ann _ (UStringNode msg)])) -- | A pragma that annotates a definition with an arbitrary value (@ {-\# ANN f 42 \#-} @) pattern AnnPragma :: AnnotationSubject dom -> Expr dom -> TopLevelPragma dom @@ -399,18 +399,18 @@ -- | A pragma that tells the compiler that a polymorph function should be optimized for a given type (@ {-\# SPECIALISE f :: Int -> b -> b \#-} @) pattern SpecializePragma :: MaybePhaseControl dom -> Name dom -> TypeList dom -> TopLevelPragma dom -pattern SpecializePragma phase def specTypes <- Ann _ (USpecializePragma phase def specTypes) +pattern SpecializePragma phase def specTypes <- Ann _ (USpecializeDecl (Ann _ (USpecializePragma phase def specTypes))) -- | Marks that the pragma should be applied from a given compile phase (@ [2] @) pattern PhaseControlFrom :: Integer -> PhaseControl dom -pattern PhaseControlFrom phaseNum <- Ann _ (UPhaseControl AnnNothing (Ann _ (PhaseNumber phaseNum))) +pattern PhaseControlFrom phaseNum <- Ann _ (UPhaseControl AnnNothing (AnnJust (Ann _ (PhaseNumber phaseNum)))) -- | Marks that the pragma should be applied until a given compile phase (@ [~2] @) pattern PhaseControlUntil :: Integer -> PhaseControl dom -pattern PhaseControlUntil phaseNum <- Ann _ (UPhaseControl (AnnJust _) (Ann _ (PhaseNumber phaseNum))) +pattern PhaseControlUntil phaseNum <- Ann _ (UPhaseControl (AnnJust _) (AnnJust (Ann _ (PhaseNumber phaseNum)))) -- | A rewrite rule (@ "map/map" forall f g xs. map f (map g xs) = map (f.g) xs @) -pattern RewriteRule :: String -> MaybePhaseControl dom -> TyVarList dom -> Expr dom -> Expr dom -> Rule dom +pattern RewriteRule :: String -> MaybePhaseControl dom -> RuleVarList dom -> Expr dom -> Expr dom -> Rule dom pattern RewriteRule name phase vars lhs rhs <- Ann _ (URule (Ann _ (UStringNode name)) phase vars lhs rhs) -- | The definition with the given name is annotated @@ -427,4 +427,4 @@ -- | A @CONLIKE@ modifier for an @INLINE@ pragma. pattern ConlikeAnnotation :: ConlikeAnnot dom -pattern ConlikeAnnotation <- Ann _ UConlikeAnnot \ No newline at end of file +pattern ConlikeAnnotation <- Ann _ UConlikeAnnot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Types.hs new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Types.hs --- old/haskell-tools-rewrite-0.5.0.0/Language/Haskell/Tools/AST/Match/Types.hs 2017-01-31 20:47:42.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/Language/Haskell/Tools/AST/Match/Types.hs 2017-05-03 22:13:56.000000000 +0200 @@ -108,7 +108,7 @@ pattern PromotedTupleType :: TypeList dom -> Type dom pattern PromotedTupleType elems <- Ann _ (UTyPromoted (Ann _ (UPromotedTuple elems))) --- | Kind of the unit value @()@. +-- | Kind of the unit value @()@. pattern PromotedUnitType :: Type dom pattern PromotedUnitType <- Ann _ (UTyPromoted (Ann _ UPromotedUnit)) @@ -124,13 +124,9 @@ -- * Contexts --- | One assertion (@ C a => ... @) -pattern ContextOne :: Assertion dom -> Context dom -pattern ContextOne n <- Ann _ (UContextOne n) - --- | A set of assertions (@ (C1 a, C2 b) => ... @, but can be one: @ (C a) => ... @) -pattern ContextMulti :: AssertionList dom -> Context dom -pattern ContextMulti n <- Ann _ (UContextMulti n) +-- | A context of assertions (@ C a => ... @) +pattern Context :: Assertion dom -> Context dom +pattern Context n <- Ann _ (UContext n) -- * Assertions @@ -145,3 +141,7 @@ -- | Assertion for implicit parameter binding (@ ?cmp :: a -> a -> Bool @) pattern ImplicitAssert :: Name dom -> Type dom -> Assertion dom pattern ImplicitAssert n t <- Ann _ (UImplicitAssert n t) + +-- | A list of assertions (@ (Eq a, Show a) @) +pattern TupleAssert :: [Assertion dom] -> Assertion dom +pattern TupleAssert ass <- Ann _ (UTupleAssert (AnnList ass)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/haskell-tools-rewrite.cabal new/haskell-tools-rewrite-0.8.0.0/haskell-tools-rewrite.cabal --- old/haskell-tools-rewrite-0.5.0.0/haskell-tools-rewrite.cabal 2017-01-31 20:55:16.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/haskell-tools-rewrite.cabal 2017-07-01 12:39:07.000000000 +0200 @@ -1,5 +1,5 @@ name: haskell-tools-rewrite -version: 0.5.0.0 +version: 0.8.0.0 synopsis: Facilities for generating new parts of the Haskell-Tools AST description: Contains utility functions to generate parts of the Haskell-Tools AST. Generates these elements to be compatible with the source annotations that are already present on the AST. The package is divided into modules based on which language elements can the given module generate. This packages should be used during the transformations to generate parts of the new AST. homepage: https://github.com/haskell-tools/haskell-tools @@ -12,7 +12,6 @@ cabal-version: >=1.10 library - ghc-options: -O2 exposed-modules: Language.Haskell.Tools.AST.Rewrite , Language.Haskell.Tools.AST.ElementTypes , Language.Haskell.Tools.AST.Gen @@ -45,21 +44,21 @@ , containers >= 0.5 && < 0.6 , references >= 0.3 && < 0.4 , ghc >= 8.0 && < 8.1 - , haskell-tools-ast >= 0.5 && < 0.6 - , haskell-tools-prettyprint >= 0.5 && < 0.6 + , haskell-tools-ast >= 0.8 && < 0.9 + , haskell-tools-prettyprint >= 0.8 && < 0.9 default-language: Haskell2010 test-suite haskell-tools-rewrite-tests type: exitcode-stdio-1.0 ghc-options: -with-rtsopts=-M2g hs-source-dirs: test - main-is: Main.hs + main-is: Main.hs build-depends: base >= 4.9 && < 4.10 , tasty >= 0.11 && < 0.12 , tasty-hunit >= 0.9 && < 0.10 , directory >= 1.2 && < 1.4 , filepath >= 1.4 && < 2.0 - , haskell-tools-ast >= 0.5 && < 0.6 - , haskell-tools-prettyprint >= 0.5 && < 0.6 - , haskell-tools-rewrite >= 0.5 && < 0.6 - default-language: Haskell2010 \ No newline at end of file + , haskell-tools-ast >= 0.8 && < 0.9 + , haskell-tools-prettyprint >= 0.8 && < 0.9 + , haskell-tools-rewrite >= 0.8 && < 0.9 + default-language: Haskell2010 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/haskell-tools-rewrite-0.5.0.0/test/Main.hs new/haskell-tools-rewrite-0.8.0.0/test/Main.hs --- old/haskell-tools-rewrite-0.5.0.0/test/Main.hs 2017-01-31 20:34:13.000000000 +0100 +++ new/haskell-tools-rewrite-0.8.0.0/test/Main.hs 2017-05-03 22:13:56.000000000 +0200 @@ -11,11 +11,11 @@ main = defaultMain genTests genTests :: TestTree -genTests = testGroup "ast generation tests" +genTests = testGroup "ast generation tests" [ testGroup "name tests" testBase , testGroup "expression tests" (map makeGenTest testExprs) , testGroup "pattern tests" (map makeGenTest testPatterns) - , testGroup "type tests" (map makeGenTest testType) + , testGroup "type tests" (map makeGenTest testType) , testGroup "binding tests" (map makeGenTest testBinds) , testGroup "declaration tests" (map makeGenTest testDecls) , testGroup "module tests" (map makeGenTest testModules) @@ -31,26 +31,26 @@ , makeGenTest ("operator name", "(+)", mkParenName $ mkSimpleName "+") ] -testExprs - = [ ("infix", "a + 3", mkInfixApp (mkVar (mkName "a")) (mkUnqualOp "+") (mkLit $ mkIntLit 3)) +testExprs + = [ ("infix", "a + 3", mkInfixApp (mkVar (mkName "a")) (mkUnqualOp "+") (mkLit $ mkIntLit 3)) , ("section", "(\"xx\" ++)", mkLeftSection (mkLit (mkStringLit "xx")) (mkUnqualOp "++")) , ("tuple", "(1, [2, 3])", mkTuple [ mkLit (mkIntLit 1), mkList [ mkLit (mkIntLit 2), mkLit (mkIntLit 3) ] ]) , ("record constructor", "P { x = 1 }", mkRecCon (mkName "P") [ mkFieldUpdate (mkName "x") (mkLit $ mkIntLit 1) ]) , ("if", "if f a then x else y" , mkIf (mkApp (mkVar $ mkName "f") (mkVar $ mkName "a")) (mkVar $ mkName "x") (mkVar $ mkName "y")) , ("let", "let nat = [0..] in !z" - , mkLet [mkLocalValBind $ mkSimpleBind' (mkName "nat") (mkEnum (mkLit (mkIntLit 0)) Nothing Nothing)] + , mkLet [mkLocalValBind $ mkSimpleBind' (mkName "nat") (mkEnum (mkLit (mkIntLit 0)) Nothing Nothing)] (mkPrefixApp (mkUnqualOp "!") (mkVar $ mkName "z")) ) , ("case", "case x of Just y -> y\n" ++ " Nothing -> 0" - , mkCase (mkVar (mkName "x")) + , mkCase (mkVar (mkName "x")) [ mkAlt (mkAppPat (mkName "Just") [mkVarPat (mkName "y")]) (mkCaseRhs $ mkVar (mkName "y")) Nothing , mkAlt (mkVarPat $ mkName "Nothing") (mkCaseRhs $ mkLit $ mkIntLit 0) Nothing ]) , ("multiway if", "if | x > y -> x\n" ++ " | otherwise -> y" - , mkMultiIf [ mkGuardedCaseRhs - [ mkGuardCheck $ mkInfixApp (mkVar (mkName "x")) (mkUnqualOp ">") (mkVar (mkName "y"))] + , mkMultiIf [ mkGuardedCaseRhs + [ mkGuardCheck $ mkInfixApp (mkVar (mkName "x")) (mkUnqualOp ">") (mkVar (mkName "y"))] (mkVar (mkName "x")) , mkGuardedCaseRhs [mkGuardCheck $ mkVar (mkName "otherwise")] (mkVar (mkName "y")) ]) @@ -64,7 +64,7 @@ testPatterns = [ ("irrefutable pattern", "~[0, a]", mkIrrefutablePat $ mkListPat [ mkLitPat (mkIntLit 0), mkVarPat (mkName "a") ]) , ("named pattern", "p@Point{ x = 1 }" - , mkAsPat (mkName "p") $ mkRecPat (mkName "Point") + , mkAsPat (mkName "p") $ mkRecPat (mkName "Point") [ mkPatternField (mkName "x") (mkLitPat (mkIntLit 1)) ]) , ("bang pattern", "!(_, f -> 3)" , mkBangPat $ mkTuplePat [mkWildPat, mkViewPat (mkVar $ mkName "f") (mkLitPat (mkIntLit 3))]) @@ -72,8 +72,8 @@ testType = [ ("forall type", "forall x . Eq x => x -> ()" - , mkForallType [mkTypeVar (mkName "x")] - $ mkCtxType (mkContextOne (mkClassAssert (mkName "Eq") [mkVarType (mkName "x")])) + , mkForallType [mkTypeVar (mkName "x")] + $ mkCtxType (mkContext (mkClassAssert (mkName "Eq") [mkVarType (mkName "x")])) $ mkFunctionType (mkVarType (mkName "x")) (mkVarType (mkName "()"))) , ("type operators", "(A :+: B) (x, x)" , mkTypeApp (mkParenType $ mkInfixTypeApp (mkVarType (mkName "A")) (mkUnqualOp ":+:") (mkVarType (mkName "B"))) @@ -100,23 +100,23 @@ , ("binding", "id x = x" , mkValueBinding $ mkFunctionBind' (mkName "id") [([mkVarPat $ mkName "x"], mkVar $ mkName "x")]) , ("datatype definition", "data A a = A a deriving Show" - , mkDataDecl mkDataKeyword Nothing (mkDeclHeadApp (mkNameDeclHead (mkName "A")) (mkTypeVar (mkName "a"))) + , mkDataDecl mkDataKeyword Nothing (mkDeclHeadApp (mkNameDeclHead (mkName "A")) (mkTypeVar (mkName "a"))) [mkConDecl (mkName "A") [mkVarType (mkName "a")]] (Just $ mkDeriving [mkInstanceHead (mkName "Show")])) , ("record definition", "data A = A { x :: Int }" - , mkDataDecl mkDataKeyword Nothing (mkNameDeclHead (mkName "A")) + , mkDataDecl mkDataKeyword Nothing (mkNameDeclHead (mkName "A")) [mkRecordConDecl (mkName "A") [mkFieldDecl [mkName "x"] (mkVarType (mkName "Int"))]] Nothing) , ("typeclass definition", "class A t => C t where f :: t\n" ++ " type T t :: *" - , mkClassDecl (Just $ mkContextOne (mkClassAssert (mkName "A") [mkVarType (mkName "t")])) + , mkClassDecl (Just $ mkContext (mkClassAssert (mkName "A") [mkVarType (mkName "t")])) (mkDeclHeadApp (mkNameDeclHead (mkName "C")) (mkTypeVar (mkName "t"))) [] (Just $ mkClassBody [ mkClassElemSig $ mkTypeSignature (mkName "f") (mkVarType (mkName "t")) - , mkClassElemTypeFam (mkDeclHeadApp (mkNameDeclHead (mkName "T")) - (mkTypeVar (mkName "t"))) + , mkClassElemTypeFam (mkDeclHeadApp (mkNameDeclHead (mkName "T")) + (mkTypeVar (mkName "t"))) (Just $ mkTypeFamilyKindSpec $ mkKindConstraint $ mkKindStar) ]) ) , ( "instance definition", "instance C Int where f = 0" - , mkInstanceDecl Nothing (mkInstanceRule Nothing $ mkAppInstanceHead (mkInstanceHead $ mkName "C") (mkVarType (mkName "Int"))) + , mkInstanceDecl Nothing (mkInstanceRule Nothing $ mkAppInstanceHead (mkInstanceHead $ mkName "C") (mkVarType (mkName "Int"))) (Just $ mkInstanceBody [mkInstanceBind $ mkSimpleBind' (mkName "f") (mkLit $ mkIntLit 0)])) , ("fixity definition", "infixl 6 +", mkFixityDecl $ mkInfixL 6 (mkUnqualOp "+")) ] @@ -124,7 +124,7 @@ testModules = [ ("empty module", "", G.mkModule [] Nothing [] []) , ("exports", "module Test(x, A(a), B(..)) where" - , G.mkModule [] (Just $ mkModuleHead (G.mkModuleName "Test") Nothing + , G.mkModule [] (Just $ mkModuleHead (G.mkModuleName "Test") Nothing (Just $ mkExportSpecs [ mkExportSpec $ mkIESpec (mkName "x") Nothing , mkExportSpec $ mkIESpec (mkName "A") (Just $ mkSubList [mkName "a"]) @@ -133,11 +133,11 @@ , ("imports", "\nimport qualified A\n" ++ "import B as BB(x)\n" ++ "import B hiding (x)" - , G.mkModule [] Nothing + , G.mkModule [] Nothing [ mkImportDecl False True False Nothing (G.mkModuleName "A") Nothing Nothing - , mkImportDecl False False False Nothing (G.mkModuleName "B") (Just $ G.mkModuleName "BB") + , mkImportDecl False False False Nothing (G.mkModuleName "B") (Just $ G.mkModuleName "BB") (Just $ mkImportSpecList [mkIESpec (mkName "x") Nothing]) - , mkImportDecl False False False Nothing (G.mkModuleName "B") Nothing + , mkImportDecl False False False Nothing (G.mkModuleName "B") Nothing (Just $ mkImportHidingList [mkIESpec (mkName "x") Nothing]) ] []) ]