derive 2.5.11 → 2.5.12
raw patch · 12 files changed
+81/−80 lines, 12 filesdep ~haskell-src-extsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: haskell-src-exts
API changes (from Hackage documentation)
- Language.Haskell.TH.FixedPpr: appPrec, noPrec, opPrec :: Precedence
- Language.Haskell.TH.FixedPpr: instance Ppr Kind
- Language.Haskell.TH.Helper: (&&::, .::, sequence__, >>::, ++::) :: [Exp] -> Exp
- Language.Haskell.TH.Helper: (==:, >:, ap', .:, >>:, >>=:, ++:, &&:) :: Exp -> Exp -> Exp
- Language.Haskell.TH.Helper: applyWith, foldr1With, foldl1With :: Exp -> [Exp] -> Exp
- Language.Haskell.TH.Helper: hNil', hZero' :: Type
- Language.Haskell.TH.Helper: return', const' :: Exp -> Exp
- Language.Haskell.TH.Helper: true, nil, false :: Valcon a => a
+ Language.Haskell.TH.FixedPpr: appPrec :: Precedence
+ Language.Haskell.TH.FixedPpr: noPrec :: Precedence
+ Language.Haskell.TH.FixedPpr: opPrec :: Precedence
+ Language.Haskell.TH.Helper: (&&:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (&&::) :: [Exp] -> Exp
+ Language.Haskell.TH.Helper: (++:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (++::) :: [Exp] -> Exp
+ Language.Haskell.TH.Helper: (.:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (.::) :: [Exp] -> Exp
+ Language.Haskell.TH.Helper: (==:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (>:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (>>:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: (>>::) :: [Exp] -> Exp
+ Language.Haskell.TH.Helper: (>>=:) :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: ap' :: Exp -> Exp -> Exp
+ Language.Haskell.TH.Helper: applyWith :: Exp -> [Exp] -> Exp
+ Language.Haskell.TH.Helper: const' :: Exp -> Exp
+ Language.Haskell.TH.Helper: false :: Valcon a => a
+ Language.Haskell.TH.Helper: foldl1With :: Exp -> [Exp] -> Exp
+ Language.Haskell.TH.Helper: foldr1With :: Exp -> [Exp] -> Exp
+ Language.Haskell.TH.Helper: hNil' :: Type
+ Language.Haskell.TH.Helper: hZero' :: Type
+ Language.Haskell.TH.Helper: nil :: Valcon a => a
+ Language.Haskell.TH.Helper: return' :: Exp -> Exp
+ Language.Haskell.TH.Helper: sequence__ :: [Exp] -> Exp
+ Language.Haskell.TH.Helper: true :: Valcon a => a
- Data.Derive.DSL.HSE: coerce :: (Typeable a, Typeable a1) => a1 -> a
+ Data.Derive.DSL.HSE: coerce :: (Typeable a1, Typeable a) => a1 -> a
- Data.Derive.UniplateTypeable: custom :: (t, DataDecl) -> [Decl] -> [Decl]
+ Data.Derive.UniplateTypeable: custom :: (t, Decl) -> [Decl] -> [Decl]
- Language.Haskell.TH.FixedPpr: ppr_sig :: (Ppr a1, Ppr a) => a -> a1 -> Doc
+ Language.Haskell.TH.FixedPpr: ppr_sig :: (Ppr a, Ppr a1) => a -> a1 -> Doc
Files
- Data/Derive/Arbitrary.hs +21/−21
- Data/Derive/ArbitraryOld.hs +36/−35
- Data/Derive/From.hs +1/−1
- Data/Derive/Internal/Traversal.hs +2/−2
- Data/Derive/JSON.hs +3/−3
- Data/Derive/Read.hs +5/−5
- Derive/Main.hs +3/−3
- Derive/Utils.hs +1/−1
- LICENSE +1/−1
- Language/Haskell.hs +3/−3
- Language/Haskell/Convert.hs +2/−2
- derive.cabal +3/−3
Data/Derive/Arbitrary.hs view
@@ -39,27 +39,27 @@ App "Do" (List [List [App "Generator" (List [App "PVar" (List [App "Ident" (List [String "x"])]),App "App" (List [App "Var" (List [ App "UnQual" (List [App "Ident" (List [String "choose"])])]),App- "Tuple" (List [List [App "ExpTypeSig" (List [App "Lit" (List [App- "Int" (List [Int 0])]),App "TyCon" (List [App "UnQual" (List [App- "Ident" (List [String "Int"])])])]),App "InfixApp" (List [App- "App" (List [App "Var" (List [App "UnQual" (List [App "Ident" (- List [String "length"])])]),App "List" (List [MapCtor (App- "RecConstr" (List [App "UnQual" (List [App "Ident" (List [CtorName- ])]),List []]))])]),App "QVarOp" (List [App "UnQual" (List [App- "Symbol" (List [String "-"])])]),App "Lit" (List [App "Int" (List- [Int 1])])])]])])]),App "Qualifier" (List [App "Case" (List [App- "Var" (List [App "UnQual" (List [App "Ident" (List [String "x"])])- ]),Concat (List [MapCtor (App "Alt" (List [App "PLit" (List [App- "Int" (List [CtorIndex])]),App "UnGuardedAlt" (List [App "Do" (- List [Concat (List [MapField (App "Generator" (List [App "PVar" (- List [App "Ident" (List [Concat (List [String "x",ShowInt- FieldIndex])])]),App "Var" (List [App "UnQual" (List [App "Ident"- (List [String "arbitrary"])])])])),List [App "Qualifier" (List [- App "App" (List [App "Var" (List [App "UnQual" (List [App "Ident"- (List [String "return"])])]),App "Paren" (List [Application (- Concat (List [List [App "Con" (List [App "UnQual" (List [App- "Ident" (List [CtorName])])])],MapField (App "Var" (List [App- "UnQual" (List [App "Ident" (List [Concat (List [String "x",+ "Tuple" (List [App "Boxed" (List []),List [App "ExpTypeSig" (List+ [App "Lit" (List [App "Int" (List [Int 0])]),App "TyCon" (List [+ App "UnQual" (List [App "Ident" (List [String "Int"])])])]),App+ "InfixApp" (List [App "App" (List [App "Var" (List [App "UnQual" (+ List [App "Ident" (List [String "length"])])]),App "List" (List [+ MapCtor (App "RecConstr" (List [App "UnQual" (List [App "Ident" (+ List [CtorName])]),List []]))])]),App "QVarOp" (List [App "UnQual"+ (List [App "Symbol" (List [String "-"])])]),App "Lit" (List [App+ "Int" (List [Int 1])])])]])])]),App "Qualifier" (List [App "Case"+ (List [App "Var" (List [App "UnQual" (List [App "Ident" (List [+ String "x"])])]),Concat (List [MapCtor (App "Alt" (List [App+ "PLit" (List [App "Int" (List [CtorIndex])]),App "UnGuardedAlt" (+ List [App "Do" (List [Concat (List [MapField (App "Generator" (+ List [App "PVar" (List [App "Ident" (List [Concat (List [String+ "x",ShowInt FieldIndex])])]),App "Var" (List [App "UnQual" (List [+ App "Ident" (List [String "arbitrary"])])])])),List [App+ "Qualifier" (List [App "App" (List [App "Var" (List [App "UnQual"+ (List [App "Ident" (List [String "return"])])]),App "Paren" (List+ [Application (Concat (List [List [App "Con" (List [App "UnQual" (+ List [App "Ident" (List [CtorName])])])],MapField (App "Var" (List+ [App "UnQual" (List [App "Ident" (List [Concat (List [String "x", ShowInt FieldIndex])])])]))]))])])])]])])]),App "BDecls" (List [ List []])])),List [App "Alt" (List [App "PWildCard" (List []),App "UnGuardedAlt" (List [App "App" (List [App "Var" (List [App
Data/Derive/ArbitraryOld.hs view
@@ -35,39 +35,40 @@ (List [App "Do" (List [List [App "Generator" (List [App "PVar" ( List [App "Ident" (List [String "x"])]),App "App" (List [App "Var" (List [App "UnQual" (List [App "Ident" (List [String "choose"])])]- ),App "Tuple" (List [List [App "Lit" (List [App "Int" (List [Int 0- ])]),App "InfixApp" (List [App "App" (List [App "Var" (List [App- "UnQual" (List [App "Ident" (List [String "length"])])]),App- "List" (List [MapCtor (App "RecConstr" (List [App "UnQual" (List [- App "Ident" (List [CtorName])]),List []]))])]),App "QVarOp" (List- [App "UnQual" (List [App "Symbol" (List [String "-"])])]),App- "Lit" (List [App "Int" (List [Int 1])])])]])])]),App "Qualifier" (- List [App "Case" (List [App "Var" (List [App "UnQual" (List [App- "Ident" (List [String "x"])])]),MapCtor (App "Alt" (List [App- "PLit" (List [App "Int" (List [CtorIndex])]),App "UnGuardedAlt" (- List [App "Do" (List [Concat (List [MapField (App "Generator" (- List [App "PVar" (List [App "Ident" (List [Concat (List [String- "x",ShowInt FieldIndex])])]),App "Var" (List [App "UnQual" (List [- App "Ident" (List [String "arbitrary"])])])])),List [App- "Qualifier" (List [App "App" (List [App "Var" (List [App "UnQual"- (List [App "Ident" (List [String "return"])])]),App "Paren" (List- [Application (Concat (List [List [App "Con" (List [App "UnQual" (- List [App "Ident" (List [CtorName])])])],MapField (App "Var" (List- [App "UnQual" (List [App "Ident" (List [Concat (List [String "x",- ShowInt FieldIndex])])])]))]))])])])]])])]),App "BDecls" (List [- List []])]))])])]])]),App "BDecls" (List [List []])])]),App- "InsDecl" (List [App "FunBind" (List [MapCtor (App "Match" (List [- App "Ident" (List [String "coarbitrary"]),List [App "PParen" (List- [App "PApp" (List [App "UnQual" (List [App "Ident" (List [CtorName- ])]),MapField (App "PVar" (List [App "Ident" (List [Concat (List [- String "x",ShowInt FieldIndex])])]))])])],App "Nothing" (List []),- App "UnGuardedRhs" (List [Fold (App "InfixApp" (List [Head,App- "QVarOp" (List [App "UnQual" (List [App "Symbol" (List [String "."- ])])]),Tail])) (Concat (List [List [App "App" (List [App "Var" (- List [App "UnQual" (List [App "Ident" (List [String "variant"])])]- ),App "Lit" (List [App "Int" (List [CtorIndex])])])],MapField (App- "App" (List [App "Var" (List [App "UnQual" (List [App "Ident" (- List [String "coarbitrary"])])]),App "Var" (List [App "UnQual" (- List [App "Ident" (List [Concat (List [String "x",ShowInt- FieldIndex])])])])]))]))]),App "BDecls" (List [List []])]))])])])]+ ),App "Tuple" (List [App "Boxed" (List []),List [App "Lit" (List [+ App "Int" (List [Int 0])]),App "InfixApp" (List [App "App" (List [+ App "Var" (List [App "UnQual" (List [App "Ident" (List [String+ "length"])])]),App "List" (List [MapCtor (App "RecConstr" (List [+ App "UnQual" (List [App "Ident" (List [CtorName])]),List []]))])])+ ,App "QVarOp" (List [App "UnQual" (List [App "Symbol" (List [+ String "-"])])]),App "Lit" (List [App "Int" (List [Int 1])])])]])]+ )]),App "Qualifier" (List [App "Case" (List [App "Var" (List [App+ "UnQual" (List [App "Ident" (List [String "x"])])]),MapCtor (App+ "Alt" (List [App "PLit" (List [App "Int" (List [CtorIndex])]),App+ "UnGuardedAlt" (List [App "Do" (List [Concat (List [MapField (App+ "Generator" (List [App "PVar" (List [App "Ident" (List [Concat (+ List [String "x",ShowInt FieldIndex])])]),App "Var" (List [App+ "UnQual" (List [App "Ident" (List [String "arbitrary"])])])])),+ List [App "Qualifier" (List [App "App" (List [App "Var" (List [App+ "UnQual" (List [App "Ident" (List [String "return"])])]),App+ "Paren" (List [Application (Concat (List [List [App "Con" (List [+ App "UnQual" (List [App "Ident" (List [CtorName])])])],MapField (+ App "Var" (List [App "UnQual" (List [App "Ident" (List [Concat (+ List [String "x",ShowInt FieldIndex])])])]))]))])])])]])])]),App+ "BDecls" (List [List []])]))])])]])]),App "BDecls" (List [List []]+ )])]),App "InsDecl" (List [App "FunBind" (List [MapCtor (App+ "Match" (List [App "Ident" (List [String "coarbitrary"]),List [App+ "PParen" (List [App "PApp" (List [App "UnQual" (List [App "Ident"+ (List [CtorName])]),MapField (App "PVar" (List [App "Ident" (List+ [Concat (List [String "x",ShowInt FieldIndex])])]))])])],App+ "Nothing" (List []),App "UnGuardedRhs" (List [Fold (App "InfixApp"+ (List [Head,App "QVarOp" (List [App "UnQual" (List [App "Symbol" (+ List [String "."])])]),Tail])) (Concat (List [List [App "App" (+ List [App "Var" (List [App "UnQual" (List [App "Ident" (List [+ String "variant"])])]),App "Lit" (List [App "Int" (List [CtorIndex+ ])])])],MapField (App "App" (List [App "Var" (List [App "UnQual" (+ List [App "Ident" (List [String "coarbitrary"])])]),App "Var" (+ List [App "UnQual" (List [App "Ident" (List [Concat (List [String+ "x",ShowInt FieldIndex])])])])]))]))]),App "BDecls" (List [List []+ ])]))])])])] -- GENERATED STOP
Data/Derive/From.hs view
@@ -61,4 +61,4 @@ valTuple [] = Con $ Special UnitCon valTuple [x] = x-valTuple xs = Tuple xs+valTuple xs = Tuple Boxed xs
Data/Derive/Internal/Traversal.hs view
@@ -59,7 +59,7 @@ , traversalFunc = \x y -> appP (Var x) y , traversalPlus = \x y -> apps (Con $ Special Cons) [paren x, paren y] , traverseArrow = Nothing- , traverseTuple = Tuple+ , traverseTuple = Tuple Boxed , traverseCtor = \x y -> apps (con x) (map paren y) , traverseFunc = undefined }@@ -161,7 +161,7 @@ if (all (== traversalId tt) tArgs) then traversalId tt else- Lambda sl [PTuple (vars pVar 't' (length args))]+ Lambda sl [PTuple Boxed (vars pVar 't' (length args))] (traverseTuple tt $ zipWith App tArgs (vars var 't' (length args))) deriveTraversalApp tt ap tycon args = do -- T a b c tCon <- deriveTraversalType tt ap tycon
Data/Derive/JSON.hs view
@@ -86,7 +86,7 @@ mkFields = if hasFields then mkShowRecordFields else mkShowPlainFields in mkJSObject $ H.List- [H.Tuple [strE (ctorDeclName c), mkFields (ctorDeclFields c)]]+ [H.Tuple H.Boxed [strE (ctorDeclName c), mkFields (ctorDeclFields c)]] mkShowPlainFields :: FieldDecl -> Exp mkShowPlainFields fs = mkJSArray $ H.List@@ -94,7 +94,7 @@ mkShowRecordFields :: FieldDecl -> Exp mkShowRecordFields fs = mkJSObject $ H.List- [ H.Tuple [strE fn, var "showJSON" `H.App` xi]+ [ H.Tuple H.Boxed [strE fn, var "showJSON" `H.App` xi] | ((fn, _), xi) <- zip fs (vars "x" fs)] ------------------------------------------------------------------------------@@ -116,7 +116,7 @@ body | hasFields = mkReadRecord cn fs | otherwise = mkReadPlain cn fs in- H.Alt sl (H.PList [H.PTuple [strP cn, pVar "y"]])+ H.Alt sl (H.PList [H.PTuple H.Boxed [strP cn, pVar "y"]]) (H.UnGuardedAlt body) (H.BDecls []) mkReadRecord :: String -> FieldDecl -> Exp
Data/Derive/Read.hs view
@@ -123,10 +123,10 @@ readCtor :: CtorDecl -> Exp readCtor c =- ListComp (Tuple [cpat, var ('r':show (cn+1))]) $+ ListComp (Tuple Boxed [cpat, var ('r':show (cn+1))]) $ matchStr (ctorDeclName c) 0 : [QualStmt $ Generator sl- (PTuple [pVar $ v 'x' 0, pVar $ v 'r' 1])+ (PTuple Boxed [pVar $ v 'x' 0, pVar $ v 'r' 1]) (apps (var "readsPrec") [H.Lit $ H.Int 11, var $ v 'r' 0]) | i <- [1..cn], let v c j = c : show (i+j)] where@@ -136,14 +136,14 @@ readFields :: CtorDecl -> Exp readFields c =- ListComp (Tuple [cpat, var $ 'r':show ((cn*4)+2)]) $+ ListComp (Tuple Boxed [cpat, var $ 'r':show ((cn*4)+2)]) $ matchStr (ctorDeclName c) 0 : concat [ matchStr (r == 1 ? "{" $ ",") r : matchStr fld (r+1) : matchStr "=" (r+2) : QualStmt (Generator sl- (PTuple [pVar $ 'x':show i, pVar $ 'r':show (r+4)])+ (PTuple Boxed [pVar $ 'x':show i, pVar $ 'r':show (r+4)]) (apps (var "readsPrec") [H.Lit $ H.Int 0, var $ 'r':show (r+3)])) : [] | (i,r,(fld,_)) <- zip3 [1..] [1,5..] (ctorDeclFields c)@@ -155,7 +155,7 @@ matchStr :: String -> Int -> QualStmt-matchStr s i = QualStmt $ Generator sl (PTuple [PLit $ H.String s, pVar $ 'r':show (i+1)]) (var "lex" `H.App` var ('r':show i))+matchStr s i = QualStmt $ Generator sl (PTuple Boxed [PLit $ H.String s, pVar $ 'r':show (i+1)]) (var "lex" `H.App` var ('r':show i))
Derive/Main.hs view
@@ -35,7 +35,7 @@ mainFile derivations flags file = do src <- readFile file src <- return $ unlines $ filter (not . isPrefixOf "#") $ lines src- let parse = fromParseResult . parseFileContentsWithMode defaultParseMode{parseFilename=file,extensions=extension}+ let parse = fromParseResult . parseFileContentsWithMode defaultParseMode{parseFilename=file,extensions=map EnableExtension extension} real = parse src mine = parse $ uncomment src flags <- return $ foldl addFlags flags@@ -54,11 +54,11 @@ -- Taken from HLint, update occasionally extension = [OverlappingInstances,UndecidableInstances,IncoherentInstances,RecursiveDo- ,ParallelListComp,MultiParamTypeClasses,NoMonomorphismRestriction,FunctionalDependencies+ ,ParallelListComp,MultiParamTypeClasses,FunctionalDependencies ,Rank2Types,RankNTypes,PolymorphicComponents,ExistentialQuantification,ScopedTypeVariables ,ImplicitParams,FlexibleContexts,FlexibleInstances,EmptyDataDecls ,KindSignatures,BangPatterns,TypeSynonymInstances,TemplateHaskell- ,ForeignFunctionInterface,Generics,NoImplicitPrelude,NamedFieldPuns,PatternGuards+ ,ForeignFunctionInterface,Generics,NamedFieldPuns,PatternGuards ,GeneralizedNewtypeDeriving,ExtensibleRecords,RestrictedTypeSynonyms,HereDocuments ,MagicHash,TypeFamilies,StandaloneDeriving,UnicodeSyntax,PatternSignatures,UnliftedFFITypes ,LiberalTypeSynonyms,TypeOperators,RecordWildCards,RecordPuns,DisambiguateRecordFields
Derive/Utils.hs view
@@ -32,7 +32,7 @@ src <- return $ takeWhile (/= "-}") $ drop 1 $ dropWhile (/= "{-") $ dropWhile (not . isPrefixOf "module ") $ lines src - let mode = defaultParseMode{extensions=[MultiParamTypeClasses,FlexibleContexts,TemplateHaskell,PackageImports,TypeOperators]}+ let mode = defaultParseMode{extensions=map EnableExtension [MultiParamTypeClasses,FlexibleContexts,TemplateHaskell,PackageImports,TypeOperators]} return $ fromParseResult $ parseFileContentsWithMode mode $ unlines $ "module Example where":src
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2006-2012.+Copyright Neil Mitchell 2006-2013. All rights reserved. Redistribution and use in source and binary forms, with or without
Language/Haskell.hs view
@@ -78,7 +78,7 @@ fExp (App op x) | op ~= "id" = x fExp (App (App flp con) x) | flp ~= "flip" && con ~= "const" = var "id" fExp (App (App con x) y) | con ~= "const" = x- fExp (App choose (Tuple [x@(ExpTypeSig _ y _),z])) | choose ~= "choose" && y == z = fExp $ App (var "return") x+ fExp (App choose (Tuple _ [x@(ExpTypeSig _ y _),z])) | choose ~= "choose" && y == z = fExp $ App (var "return") x fExp (App op x) | op ~= "id" = x fExp (InfixApp (App when true) dot res) | when ~= "when" && true ~= "True" = res@@ -116,9 +116,9 @@ fPat (PParen x@(PApp _ [])) = x fPat (PParen (PParen x)) = PParen x fPat (PApp nam xs) = case rename nam of- Special (TupleCon Boxed _) -> PTuple xs+ Special (TupleCon Boxed _) -> PTuple Boxed xs nam -> PApp nam xs- fPat (PParen (PTuple xs)) = PTuple xs+ fPat (PParen (PTuple l xs)) = PTuple l xs fPat x = x fMatch (Match sl nam pat sig (GuardedRhss [GuardedRhs _ [Qualifier x] bod]) decls)
Language/Haskell/Convert.hs view
@@ -150,7 +150,7 @@ conv (LeftSection x y) = InfixE (Just $ c x) (c y) Nothing conv (RightSection y z) = InfixE Nothing (c y) (Just $ c z) conv (Lambda _ x y) = LamE (c x) (c y)- conv (Tuple x) = TupE (c x)+ conv (Tuple _ x) = TupE (c x) conv (If x y z) = CondE (c x) (c y) (c z) conv (Let x y) = LetE (c x) (c y) conv (Case x y) = CaseE (c x) (c y)@@ -175,7 +175,7 @@ instance Convert HS.Pat TH.Pat where conv (PParen x) = c x conv (PLit x) = LitP (c x)- conv (PTuple x) = TupP (c x)+ conv (PTuple _ x) = TupP (c x) conv (PApp x y) = ConP (c x) (c y) conv (PVar x) = VarP (c x) conv (PInfixApp x y z) = InfixP (c x) (c y) (c z)
derive.cabal view
@@ -1,9 +1,9 @@ cabal-version: >= 1.6 build-type: Default name: derive-version: 2.5.11+version: 2.5.12 build-type: Simple-copyright: Neil Mitchell 2006-2012+copyright: Neil Mitchell 2006-2013 author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com> homepage: http://community.haskell.org/~ndm/derive/@@ -32,7 +32,7 @@ base == 4.*, filepath, syb, template-haskell, containers, pretty, directory, process, bytestring,- haskell-src-exts >= 1.9 && < 1.14,+ haskell-src-exts >= 1.14 && < 1.15, transformers >= 0.2 && < 0.4, uniplate >= 1.5 && < 1.7