packages feed

derive 2.5.4 → 2.5.5

raw patch · 5 files changed

+35/−18 lines, 5 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Data.Derive.ArbitraryOld: dslArbitraryOld :: DSL
+ Data.Derive.Arities: dslArities :: DSL
+ Data.Derive.Binary: dslBinary :: DSL
+ Data.Derive.BinaryDefer: dslBinaryDefer :: DSL
+ Data.Derive.Bounded: dslBounded :: DSL
+ Data.Derive.DSL.DSL: append :: DSL -> DSL -> DSL
+ Data.Derive.DSL.DSL: box :: DSL -> DSL
+ Data.Derive.DSL.DSL: nil :: DSL
+ Data.Derive.DSL.HSE: coerce :: (Typeable a, Typeable a1) => a1 -> a
+ Data.Derive.DSL.HSE: ctorArity :: CtorDecl -> Integer
+ Data.Derive.DSL.HSE: ctorName :: CtorDecl -> String
+ Data.Derive.DSL.HSE: dataCtors :: DataDecl -> [CtorDecl]
+ Data.Derive.DSL.HSE: dataName :: DataDecl -> String
+ Data.Derive.DSL.HSE: dataVars :: DataDecl -> Int
+ Data.Derive.DSL.HSE: out :: Data a => a -> Output
+ Data.Derive.DSL.HSE: readCon :: DataType -> [Char] -> Constr
+ Data.Derive.DSL.HSE: showOut :: Pretty a => [a] -> String
+ Data.Derive.Default: dslDefault :: DSL
+ Data.Derive.Enum: dslEnum :: DSL
+ Data.Derive.EnumCyclic: dslEnumCyclic :: DSL
+ Data.Derive.Eq: dslEq :: DSL
+ Data.Derive.NFData: dslNFData :: DSL
+ Data.Derive.Ord: dslOrd :: DSL
+ Data.Derive.Serial: dslSerial :: DSL
+ Data.Derive.Serialize: dslSerialize :: DSL
+ Data.Derive.UniplateTypeable: custom :: (t, DataDecl) -> [Decl] -> [Decl]
+ Language.Haskell: (?) :: Bool -> a -> a -> a
+ Language.Haskell: (~=) :: Pretty a => a -> String -> Bool
+ Language.Haskell: appP :: Exp -> Exp -> Exp
+ Language.Haskell: apps :: Exp -> [Exp] -> Exp
+ Language.Haskell: con :: String -> Exp
+ Language.Haskell: fromBangType :: BangType -> Type
+ Language.Haskell: fromTyApps :: Type -> (Type, [Type])
+ Language.Haskell: fromTyList :: Type -> Maybe Type
+ Language.Haskell: fromTyParen :: Type -> Type
+ Language.Haskell: fromTyParens :: Type -> Type
+ Language.Haskell: fromTyTuple :: Type -> [Type]
+ Language.Haskell: isAtom :: Exp -> Bool
+ Language.Haskell: isGuardFalse :: Match -> Bool
+ Language.Haskell: isTyFun :: Type -> Bool
+ Language.Haskell: isTyParen :: Type -> Bool
+ Language.Haskell: moduleDecls :: Module -> [Decl]
+ Language.Haskell: moduleImports :: Module -> [ImportDecl]
+ Language.Haskell: moduleName :: Module -> ModuleName
+ Language.Haskell: modulePragmas :: Module -> [ModulePragma]
+ Language.Haskell: noSl :: Data from => from -> from
+ Language.Haskell: pVar :: String -> Pat
+ Language.Haskell: paren :: Exp -> Exp
+ Language.Haskell: qname :: String -> QName
+ Language.Haskell: qvop :: String -> QOp
+ Language.Haskell: rename :: QName -> QName
+ Language.Haskell: showDecls :: Pretty a => [a] -> String
+ Language.Haskell: sl :: SrcLoc
+ Language.Haskell: title :: [Char] -> [Char]
+ Language.Haskell: tyApp :: Type -> [Type] -> Type
+ Language.Haskell: tyApps :: Type -> [Type] -> Type
+ Language.Haskell: tyCon :: String -> Type
+ Language.Haskell: tyFun :: [Type] -> Type
+ Language.Haskell: tyRoot :: Type -> String
+ Language.Haskell: tyVar :: String -> Type
+ Language.Haskell: tyVarBind :: String -> TyVarBind
+ Language.Haskell: var :: String -> Exp
+ Language.Haskell.TH.FixedPpr: ppr_sig :: (Ppr a1, Ppr a) => a -> a1 -> Doc
+ Language.Haskell.TH.Helper: id' :: Exp
+ Language.Haskell.TH.Helper: unit :: Exp
- Language.Haskell.TH.FixedPpr: class Ppr a
+ Language.Haskell.TH.FixedPpr: class Ppr a where ppr_list = vcat . map ppr

Files

Data/Derive/UniplateDirect.hs view
@@ -2,19 +2,24 @@ -- NOTE: Cannot be guessed as it relies on type information  -- | Derive Uniplate and Biplate using the Direct combinators.---   You must specific monomorphic instances, i.e:+--   You must request monomorphic instances, i.e: ----- > data Foo a = Foo a Int+-- > data Foo a = Foo a (Bool, a) -- > -- > {-! -- > deriving instance UniplateDirect (Foo Int)+-- > deriving instance UniplateDirect (Bool, Int) Int -- > deriving instance UniplateDirect (Foo Int) Int -- > !-} -----   All types referred to must be in scope at the time.+--   This will generate the instances @Uniplate (Foo Int)@,+--   @Biplate (Bool, Int) Int@ and @Biplate (Foo Int) Int@.+--   Generally, start with the instance you are after (e.g. @UniplateDirect (Foo Int)@),+--   try to compile and add further instances as necessary. @UniplateDirect@ with+--   one argument derives Uniplate, and with two arguments derives Biplate. -----   @deriving UniplateDirect@ with no arguments will be assumed to derive the Uniplate---   instance on all types being unit.+--   @deriving UniplateDirect@ on a data type with no arguments derives Uniplate+--   with all type parameters defaulting to @()@. module Data.Derive.UniplateDirect(makeUniplateDirect) where  
Derive/Flags.hs view
@@ -11,7 +11,7 @@   data Flag = Version | Help | Output String | Import String | Modu String-          | Append | Derive [String] | NoOpts | Test | Generate+          | Append | Derive [String] | NoOpts | Preprocessor | Test | Generate             deriving (Eq, Show)  @@ -25,6 +25,7 @@     ,Option "a"  ["append"]   (NoArg Append)           "append the result to the file"     ,Option "d"  ["derive"]   (ReqArg splt "DERIVES")  "things to derive for all types"     ,Option "n"  ["no-opts"]  (NoArg NoOpts)           "ignore the file options"+    ,Option "F"  ["preprocessor"] (NoArg Preprocessor) "operate as a GHC preprocessor with -pgmF"     ,Option ""   ["test"]     (NoArg Test)             "run the test suite"     ,Option ""   ["generate"] (NoArg Generate)         "perform code generation"     ]@@ -40,6 +41,7 @@     case getOpt Permute options args of         (o,n,[]  ) | Version `elem` o -> putStrLn "Derive 2.4.* (C) Neil Mitchell 2006-2011" >> exitSuccess                    | Help `elem` o    -> putStr flagInfo >> exitSuccess+                   | Preprocessor `elem` o -> return (o,n)                    | otherwise        -> do files <- mapM pickFile n; return (o, files)         (_,_,errs) -> hPutStr stderr (concat errs ++ flagInfo) >> exitFailure     where
Derive/Main.hs view
@@ -8,6 +8,7 @@ import Derive.Test import Derive.Flags import Data.List+import System.Directory   deriveMain :: [Derivation] -> IO ()@@ -17,6 +18,13 @@         test      else if Generate `elem` flags then         generate+     else if Preprocessor `elem` flags then+        (if length files /= 3 then+            error $ "Expected to be invoked as a GHC preprocessor with 3 files, but got " ++ show (length files)+         else do+            copyFile (files !! 1) (files !! 2)+            mainFile derivations (Append:flags) (files !! 2)+         )      else if null files then         putStr $ "No files specified\n" ++ flagInfo      else
derive.cabal view
@@ -1,7 +1,7 @@ cabal-version:  >= 1.6 build-type:     Default name:           derive-version:        2.5.4+version:        2.5.5 build-type:     Simple copyright:      Neil Mitchell 2006-2011 author:         Neil Mitchell <ndmitchell@gmail.com>
derive.htm view
@@ -79,18 +79,8 @@ <h2>Obtaining and Installing Data.Derive</h2>  <p>-	Data.Derive is available using <a href="http://darcs.net/">darcs</a>:-</p>-<pre>-darcs get --partial <a href="http://community.haskell.org/~ndm/darcs/derive">http://community.haskell.org/~ndm/darcs/derive</a>-</pre>-<p>-	Install the program using the standard sequence of Cabal magic:+	Installation follows the standard pattern of any Haskell library or program, type <tt>cabal update</tt> to update your local hackage database, then <tt>cabal install derive</tt> to install Derive. </p>-<pre>-cabal update-cabal install derive-</pre>   <h2>Supported Derivations</h2>@@ -175,6 +165,18 @@  <p> 	One way is to append the text to the bottom of the module, this can be done by passing the <tt>--append</tt> flag. If this is done, Derive will generate the required instances and place them at the bottom of the file, along with a checksum. Do not modify these instances.+</p>++<h3>As a GHC preprocessor</h3>++<p>+	To use Derive as a GHC preprocessor, add the following line at the top of the source file:+</p>+<pre>+{-# OPTIONS_GHC -F -pgmFderive -optF-F #-}+</pre>+<p>+	This instructs GHC to apply a preprocessor (<tt>-F</tt>), and to use the preprocessor <tt>derive -F</tt>. </p>  <h3>Using CPP</h3>