DrIFT-cabalized 2.2.3.2 → 2.2.3.3
raw patch · 15 files changed
+290/−295 lines, 15 filesdep ~basenew-uploader
Dependency ranges changed: base
Files
- ChangeLog +0/−143
- Changelog +143/−0
- DrIFT-cabalized.cabal +7/−7
- README +18/−29
- code/FunctorM.hs +2/−2
- code/GhcBinary.hs +50/−50
- code/README.txt +1/−1
- docs/drift.info +23/−24
- src/DataP.lhs +0/−2
- src/DrIFT.hs +6/−7
- src/GenUtil.hs +25/−14
- src/Rules.hs +15/−13
- src/Rules/Monoid.hs +0/−1
- src/Rules/Utility.hs +0/−1
- src/Unlit.hs +0/−1
− ChangeLog
@@ -1,143 +0,0 @@-DrIFT-2.2.2:- * redid build model, collect deriving rules automatically.---DrIFT-2.2.1:-- Mon Aug 14 19:22:26 PDT 2006 John Meacham <john@repetae.net>- * update autotools to make autoreconf work- * update README to reflect there no longer being a 'reconf' script- * get rid of recursive make in docs/ subdirectory--Thu Jan 25 21:04:02 PST 2007 John Meacham <john@repetae.net>- * add support for Data.Binary, move old Binary to BitsBinary---DrIFT-2.2.0:--Mon Apr 10 00:39:24 PDT 2006 John Meacham <john@repetae.net>- * add note about reconf script- * make the parser handle newtype deriving without bailing out- * fix bug in Ord deriving rule--Wed Jan 18 03:59:21 PST 2006 David Roundy <droundy@darcs.net>- * fix typo in src/Makefile.am--Sun Nov 27 02:59:14 PST 2005 Malcolm.Wallace@cs.york.ac.uk- * Change rule for Haskell2XmlNew into XmlContent, add Parse rule.- The Haskell2XmlNew class was a temporary staging post on the way to- developing a new XmlContent class, available in HaXml-1.14 onwards.- This patch updates the name, and the rule, to match the latest- developments. It also adds support for the textual (non-XML) Parse- class, which is an experimental replacement for the Read class, using- monadic parser combinators. This is also currently defined in- HaXml-1.14.- * docs should refer to StandardRules.hs, not .lhs- * fix docs for Hugs usage- * keep docs of --list option up-to-date--Tue Nov 15 18:09:40 PST 2005 Einar Karttunen <ekarttun@cs.helsinki.fi>- * Hook Arbitrary into DrIFT proper- * Add UserRuleArbitrary--Thu Nov 3 02:52:38 PST 2005 John Meacham <john@repetae.net>- * fix data derving for new versions of ghc--DrIFT-2.1.2:-- * fix rpm building, autoconf and some general make issues- * fix warnings in generated binary instances- * fix autoconf warnings--Mon Sep 12 08:11:10 PDT 2005 Malcolm.Wallace@cs.york.ac.uk- * support for Haskell2XmlNew- The HaXml library Haskell2Xml has been extended to make secondary parsing- of the generic XML content tree into a typed value more robust. An API- change means that a new version of the class (unimaginatively called- Haskell2XmlNew) exists, and this patch adds the ability to generate- parsing code for the new class.- * doc updates- Fix some very out-of-date statements in the manual.--Tue May 31 16:17:12 PDT 2005 Samuel Bronson <naesten@gmail.com>- * avoid problems with hmake by invoking ghc -M directly- * Default to GHC to avoid NHC's tiny heap--DrIFT-2.1.1:--Tue Apr 19 21:09:13 PDT 2005 John Meacham <john@repetae.net>- * Be sure to flush handles pointing to files before quitting- * fix off-by-one line number error- * Remove reference to genconf- * Updated GenUtil.hs to fix nhc build---DrIFT-2.1.0:- * added 'get' utility which creates foo_g for each label which returns its- value in a failing monad rather than raising an error.- * added 'from' utility which creates fromFoo for each constructors- * no longer an error for DERIVEPATH to not be set- * added -i to ignore directives in file. useful with -g and -r for testing- * added 'Query' which creates from, get, has, and is functions, but in a- class with an instance for the data type. useful for extensible data types- * added deriving rule for 'Monoid'- * added code subdirectory with support code--DrIFT-2.0.4:- * added rule for GhcBinary- * now allows record syntax with newtype--DrIFT-2.0.3:- * 'update' functions now pass through values without the specified field- * drift-ghc script added to be used with ghc by passing -pgmF drift-ghc -F- * documentation updated.--DrIFT-2.0.2:- * deriving 'update' works with newer versions of ghc- * fixed bug in Show and Read instances--DrIFT-2.0.1:- * fixed many warnings in generated code- * support for strict fields in constructors- * support for infix constructors--DrIFT-2.0rc4:- * added help messages and categorization to rules- * small isLiterate fix (TODO use nhcs deliterizer)- * prints debug info in comment in chaseImports- * code cleanups- * integrated some changes from Strafunski 1.7- * autoconf/automake improvements--DrIFT-2.0rc3:- * fixed version strings in generated files- * fix dependency generation- * fixed example test cases--DrIFT-2.0rc2:- * autoconf/automake added- * texinfo is installed properly now- * build system cleanups- * works with both nhc and ghc again--DrIFT-2.0rc1:- * new texinfo documentation, based on Noel's original manual.- * new option '-r' to only emit results and not original source- * new option '-g' to add new global rules to apply.- * cleaned up old non haskell98-compliant hacks--jDrIFT-1:- * proper GetOpt command line handling, allows you to specify an- output file (-o) as well as list all possible derivations this- version was compiled with (-l)- * proper LINE pragmas in generated code- * smarter error handling in some cases, parser smarter sometimes.- * can deal with/ignore as appropriate some ghc extensions now- * rules to derive Typeable used by the Dynamic library.- * rules to derive Observable from the HOOD object debugger- * rules to derive Term, a generic term representation for generic- computation, can be used in a similar fashion to the Strafunski one,- but has a number of advantages, fully lazy constant time implode/explode- being the main one. (the external library is compatable with their work.)--
+ Changelog view
@@ -0,0 +1,143 @@+DrIFT-2.2.2:+ * redid build model, collect deriving rules automatically.+++DrIFT-2.2.1:++ Mon Aug 14 19:22:26 PDT 2006 John Meacham <john@repetae.net>+ * update autotools to make autoreconf work+ * update README to reflect there no longer being a 'reconf' script+ * get rid of recursive make in docs/ subdirectory++Thu Jan 25 21:04:02 PST 2007 John Meacham <john@repetae.net>+ * add support for Data.Binary, move old Binary to BitsBinary+++DrIFT-2.2.0:++Mon Apr 10 00:39:24 PDT 2006 John Meacham <john@repetae.net>+ * add note about reconf script+ * make the parser handle newtype deriving without bailing out+ * fix bug in Ord deriving rule++Wed Jan 18 03:59:21 PST 2006 David Roundy <droundy@darcs.net>+ * fix typo in src/Makefile.am++Sun Nov 27 02:59:14 PST 2005 Malcolm.Wallace@cs.york.ac.uk+ * Change rule for Haskell2XmlNew into XmlContent, add Parse rule.+ The Haskell2XmlNew class was a temporary staging post on the way to+ developing a new XmlContent class, available in HaXml-1.14 onwards.+ This patch updates the name, and the rule, to match the latest+ developments. It also adds support for the textual (non-XML) Parse+ class, which is an experimental replacement for the Read class, using+ monadic parser combinators. This is also currently defined in+ HaXml-1.14.+ * docs should refer to StandardRules.hs, not .lhs+ * fix docs for Hugs usage+ * keep docs of --list option up-to-date++Tue Nov 15 18:09:40 PST 2005 Einar Karttunen <ekarttun@cs.helsinki.fi>+ * Hook Arbitrary into DrIFT proper+ * Add UserRuleArbitrary++Thu Nov 3 02:52:38 PST 2005 John Meacham <john@repetae.net>+ * fix data derving for new versions of ghc++DrIFT-2.1.2:++ * fix rpm building, autoconf and some general make issues+ * fix warnings in generated binary instances+ * fix autoconf warnings++Mon Sep 12 08:11:10 PDT 2005 Malcolm.Wallace@cs.york.ac.uk+ * support for Haskell2XmlNew+ The HaXml library Haskell2Xml has been extended to make secondary parsing+ of the generic XML content tree into a typed value more robust. An API+ change means that a new version of the class (unimaginatively called+ Haskell2XmlNew) exists, and this patch adds the ability to generate+ parsing code for the new class.+ * doc updates+ Fix some very out-of-date statements in the manual.++Tue May 31 16:17:12 PDT 2005 Samuel Bronson <naesten@gmail.com>+ * avoid problems with hmake by invoking ghc -M directly+ * Default to GHC to avoid NHC's tiny heap++DrIFT-2.1.1:++Tue Apr 19 21:09:13 PDT 2005 John Meacham <john@repetae.net>+ * Be sure to flush handles pointing to files before quitting+ * fix off-by-one line number error+ * Remove reference to genconf+ * Updated GenUtil.hs to fix nhc build+++DrIFT-2.1.0:+ * added 'get' utility which creates foo_g for each label which returns its+ value in a failing monad rather than raising an error.+ * added 'from' utility which creates fromFoo for each constructors+ * no longer an error for DERIVEPATH to not be set+ * added -i to ignore directives in file. useful with -g and -r for testing+ * added 'Query' which creates from, get, has, and is functions, but in a+ class with an instance for the data type. useful for extensible data types+ * added deriving rule for 'Monoid'+ * added code subdirectory with support code++DrIFT-2.0.4:+ * added rule for GhcBinary+ * now allows record syntax with newtype++DrIFT-2.0.3:+ * 'update' functions now pass through values without the specified field+ * drift-ghc script added to be used with ghc by passing -pgmF drift-ghc -F+ * documentation updated.++DrIFT-2.0.2:+ * deriving 'update' works with newer versions of ghc+ * fixed bug in Show and Read instances++DrIFT-2.0.1:+ * fixed many warnings in generated code+ * support for strict fields in constructors+ * support for infix constructors++DrIFT-2.0rc4:+ * added help messages and categorization to rules+ * small isLiterate fix (TODO use nhcs deliterizer)+ * prints debug info in comment in chaseImports+ * code cleanups+ * integrated some changes from Strafunski 1.7+ * autoconf/automake improvements++DrIFT-2.0rc3:+ * fixed version strings in generated files+ * fix dependency generation+ * fixed example test cases++DrIFT-2.0rc2:+ * autoconf/automake added+ * texinfo is installed properly now+ * build system cleanups+ * works with both nhc and ghc again++DrIFT-2.0rc1:+ * new texinfo documentation, based on Noel's original manual.+ * new option '-r' to only emit results and not original source+ * new option '-g' to add new global rules to apply.+ * cleaned up old non haskell98-compliant hacks++jDrIFT-1:+ * proper GetOpt command line handling, allows you to specify an+ output file (-o) as well as list all possible derivations this+ version was compiled with (-l)+ * proper LINE pragmas in generated code+ * smarter error handling in some cases, parser smarter sometimes.+ * can deal with/ignore as appropriate some ghc extensions now+ * rules to derive Typeable used by the Dynamic library.+ * rules to derive Observable from the HOOD object debugger+ * rules to derive Term, a generic term representation for generic+ computation, can be used in a similar fashion to the Strafunski one,+ but has a number of advantages, fully lazy constant time implode/explode+ being the main one. (the external library is compatable with their work.)++
DrIFT-cabalized.cabal view
@@ -1,5 +1,5 @@ name: DrIFT-cabalized-version: 2.2.3.2+version: 2.2.3.3 synopsis: Program to derive type class instances description: DrIFT is a type sensitive preprocessor for Haskell. It extracts type declarations and directives from modules. The directives cause rules to be fired on the parsed@@ -18,23 +18,23 @@ license-file: LICENSE -- For contributors & what they did, see AUTHORS author: Noel Winstanley, John Meacham <john@repetae.net>-maintainer: <gwern0@gmail.com>+maintainer: <gwern0@gmail.com>, Kiwamu Okabe <kiwamu@debian.or.jp> homepage: http://repetae.net/computer/haskell/DrIFT/ Cabal-Version: >= 1.6 build-type: Simple-data-files: AUTHORS, ChangeLog, README, README.old, code/README.txt, docs/drift.texi, docs/drift.info,+data-files: AUTHORS, Changelog, README, README.old, code/README.txt, docs/drift.texi, docs/drift.info, example/README, example/TestTerm.out.correct extra-source-files: code/GhcBinary.hs, code/FunctorM.hs, example/TestTerm.hs, example/BTree.hs, example/Foo.lhs, example/Xref.hs, example/Artifical.hs, example/Example.hs source-repository head- type: darcs- location: http://repetae.net/repos/DrIFT+ type: git+ location: https://github.com/ajhc/drift.git executable DrIFT-cabalized- build-depends: base<4, old-time, random+ build-depends: base >= 4.0 && < 5, random, old-time main-is: DrIFT.hs hs-source-dirs: src, ./ other-modules: CommandP, Version, GenUtil, Rules, Rules.Binary,@@ -47,6 +47,6 @@ ghc-options: -Wall executable DrIFT-cabalized-ghc- build-depends: base<4, process+ build-depends: base >= 4.0 && < 5, process main-is: drift-ghc.hs ghc-options: -Wall
README view
@@ -5,8 +5,8 @@ This package contains a source distribution of DrIFT, a tool for automatic derivation of Haskell class instances. DrIFT was formerly known as Derive. -The current homepage is at:- <http://repetae.net/john/computer/haskell/DrIFT/>+the current homepage is at+ http://repetae.net/john/computer/haskell/DrIFT/ ------------------------------------------------------------------------------@@ -20,47 +20,36 @@ ------------------------------------------------------------------------------ -If you have pulled the source from the darcs repository, you must first build-the autotools scripts by running-- $ autoreconf -i--To configure and install DrIFT from source or from Hackage, you have two options.--- AUTOTOOLS--You can install through the GNU Autools, like thus:+To configure and install DrIFT from the source tarball - $ ./configure --prefix=<dir>- $ make install+ ./configure --prefix=<dir>+ make install Where <dir> is the directory in which you want to install the tool. Note that-a Haskell compiler (NHC or GHC) must be in your path. Otherwise, supply the+a haskell compiler (nhc98 or ghc) must be in your path. Otherwise, supply the location of a Haskell compiler as follows: - $ ./configure --prefix=<dir> --with-hc=<Haskell compiler>- $ make install+ ./configure --prefix=<dir> --with-hc=<haskell compiler>+ make install - CABAL -You can also install through Cabal, the standard Haskell packaging tool with the usual set of commands:+If you have pulled the source from the darcs repository, you must first build+the autotools scripts by running - $ runhaskell Setup configure # optional --user --prefix=/home/user/bin- $ runhaskell Setup build- $ runhaskell Setup install # --user+ autoreconf -i -(Remember, from Darcs requires autoreconf to have been run! If you are installing from Hackage, autoreconf should have already been run in the source tarball.) ------------------------------------------------------------------------------ -You may optionally set the environmental variable $DERIVEPATH to the list of directories you wish to search for modules.+You may optionally sset DERIVEPATH to the list of directories you wish to search for+modules. -An example:+as an example: - DERIVEPATH=/users/grad/nww/share/hugs/lib:/users/grad/nww/share/hugs/lib/hugs+DERIVEPATH=/users/grad/nww/share/hugs/lib:/users/grad/nww/share/hugs/lib/hugs -to run DrIFT, simply pass the Haskell file name as an argument. You may run-'DrIFT --help' to get a summary of the various command line options+to run DrIFT, simply pass the haskell file name as an argument. you may run+DrIFT --help to get a summary of the various command line options+
code/FunctorM.hs view
@@ -1,6 +1,6 @@ module FunctorM where -import Data.Array (array, assocs, bounds, Array(), Ix())+import Array class FunctorM f where fmapM :: Monad m => (a -> m b) -> f a -> m (f b)@@ -11,7 +11,7 @@ instance FunctorM Maybe where fmapM _ Nothing = return Nothing- fmapM f (Just x) = f x >>= return . Just+ fmapM f (Just x) = f x >>= return . Just instance Ix i => FunctorM (Array i) where fmapM f a = sequence [ f e >>= return . (,) i | (i,e) <- assocs a] >>= return . array b where
code/GhcBinary.hs view
@@ -72,8 +72,8 @@ import System.IO ( openBinaryFile ) import PackedString --import Atom-import System.Time-import Control.Monad+import Time+import Monad import Data.Array.IArray import Data.Array.Base @@ -144,7 +144,7 @@ -- Bin --------------------------------------------------------------- -newtype Bin a = BinPtr Int+newtype Bin a = BinPtr Int deriving (Eq, Ord, Show, Bounded) castBin :: Bin a -> Bin b@@ -172,7 +172,7 @@ getAt bh p = do seekBin bh p; get bh openBinIO_ :: IO.Handle -> IO BinHandle-openBinIO_ h = openBinIO h+openBinIO_ h = openBinIO h openBinIO :: IO.Handle -> IO BinHandle openBinIO h = do@@ -197,7 +197,7 @@ tellBin (BinMem r _ _) = do ix <- readFastMutInt r; return (BinPtr ix) seekBin :: BinHandle -> Bin a -> IO ()-seekBin (BinIO ix_r h) (BinPtr p) = do+seekBin (BinIO ix_r h) (BinPtr p) = do writeFastMutInt ix_r p hSeek h AbsoluteSeek (fromIntegral p) seekBin h@(BinMem ix_r sz_r a) (BinPtr p) = do@@ -262,11 +262,11 @@ ix <- readFastMutInt ix_r sz <- readFastMutInt sz_r -- double the size of the array if it overflows- if (ix >= sz)- then do+ if (ix >= sz) + then do expandBin h ix putWord8 h w- else do+ else do arr <- readIORef arr_r unsafeWrite arr ix w writeFastMutInt ix_r (ix+1)@@ -330,9 +330,9 @@ w2 <- getWord8 h w3 <- getWord8 h w4 <- getWord8 h- return $! ((fromIntegral w1 `shiftL` 24) .|.- (fromIntegral w2 `shiftL` 16) .|.- (fromIntegral w3 `shiftL` 8) .|.+ return $! ((fromIntegral w1 `shiftL` 24) .|. + (fromIntegral w2 `shiftL` 16) .|. + (fromIntegral w3 `shiftL` 8) .|. (fromIntegral w4)) @@ -355,13 +355,13 @@ w6 <- getWord8 h w7 <- getWord8 h w8 <- getWord8 h- return $! ((fromIntegral w1 `shiftL` 56) .|.- (fromIntegral w2 `shiftL` 48) .|.- (fromIntegral w3 `shiftL` 40) .|.- (fromIntegral w4 `shiftL` 32) .|.- (fromIntegral w5 `shiftL` 24) .|.- (fromIntegral w6 `shiftL` 16) .|.- (fromIntegral w7 `shiftL` 8) .|.+ return $! ((fromIntegral w1 `shiftL` 56) .|. + (fromIntegral w2 `shiftL` 48) .|. + (fromIntegral w3 `shiftL` 40) .|. + (fromIntegral w4 `shiftL` 32) .|. + (fromIntegral w5 `shiftL` 24) .|. + (fromIntegral w6 `shiftL` 16) .|. + (fromIntegral w7 `shiftL` 8) .|. (fromIntegral w8)) -- -----------------------------------------------------------------------------@@ -427,33 +427,33 @@ put_ bh (ctSec t) get bh = do year <- get bh- month <- fmap toEnum $ get bh- day <- get bh- hour <- get bh- min <- get bh- sec <- get bh+ month <- fmap toEnum $ get bh + day <- get bh + hour <- get bh + min <- get bh + sec <- get bh return $ toClockTime $ (toUTCTime epoch) {ctYear = year, ctDay = day, ctMonth = month, ctHour = hour, ctMin = min, ctSec = sec} epoch = toClockTime $ CalendarTime { ctYear = 1970, ctMonth = January, ctDay = 0, ctHour = 0, ctMin = 0, ctSec = 0, ctTZ = 0, ctPicosec = 0, ctWDay = undefined, ctYDay = undefined, ctTZName = undefined, ctIsDST = undefined} instance Binary PackedString where put_ bh (PS a) = put_ bh a- get bh = fmap PS $ get bh+ get bh = fmap PS $ get bh --put_ bh $ (snd $ Data.Array.IArray.bounds a) + 1 --mapM_ (put_ bh) (Data.Array.IArray.elems a) --sz <- get bh --x <- sequence $ replicate sz (get bh)---return $ PS (Data.Array.IArray.listArray (0,sz - 1) x)+--return $ PS (Data.Array.IArray.listArray (0,sz - 1) x) ---put_ bh ps = put_ bh (unpackPS ps)+--put_ bh ps = put_ bh (unpackPS ps) --get bh = liftM packString $ get bh---put_ bh ps = putNList_ bh (unpackPS ps)+--put_ bh ps = putNList_ bh (unpackPS ps) --get bh = liftM packString $ getNList bh-+ -- putNList_ bh xs = do -- put_ bh (length xs) -- mapM_ (put_ bh) xs---+-- -- getNList bh = do -- l <- get bh -- sequence $ replicate l (get bh)@@ -500,12 +500,12 @@ instance Binary a => Binary (Maybe a) where put_ bh Nothing = putByte bh 0 put_ bh (Just a) = do putByte bh 1; put_ bh a- get bh = do+ get bh = do h <- getWord8 bh case h of 0 -> return Nothing- _ -> do- x <- get bh+ _ -> do + x <- get bh return (Just x) instance (Binary a, Binary b) => Binary (Either a b) where@@ -522,7 +522,7 @@ instance Binary (UArray Int Word8) where put_ bh@(BinIO ix_r h) ua = do let sz = rangeSize (Data.Array.IO.bounds ua)- ix <- readFastMutInt ix_r+ ix <- readFastMutInt ix_r put_ bh sz ua <- unsafeThaw ua hPutArray h ua sz@@ -533,15 +533,15 @@ case sz of I# i -> putByteArray bh ba i get bh@(BinIO ix_r h) = do- ix <- readFastMutInt ix_r- sz <- get bh+ ix <- readFastMutInt ix_r + sz <- get bh ba <- newArray_ (0, sz - 1)- hGetArray h ba sz+ hGetArray h ba sz writeFastMutInt ix_r (ix + sz + 4)- ba <- unsafeFreeze ba+ ba <- unsafeFreeze ba return ba get bh = do- sz <- get bh+ sz <- get bh BA ba <- getByteArray bh sz return $ UArray 0 (sz - 1) ba @@ -554,12 +554,12 @@ case (rangeSize (s,e)) of I# i -> putByteArray bh ba i get bh = do- s <- get bh+ s <- get bh e <- get bh BA ba <- getByteArray bh (rangeSize (s,e)) return $ UArray s e ba --}+-} -- #ifdef __GLASGOW_HASKELL__ instance Binary Integer where@@ -570,8 +570,8 @@ let sz# = sizeofByteArray# a# -- in *bytes* put_ bh (I# sz#) -- in *bytes* putByteArray bh a# sz#-- get bh = do+ + get bh = do b <- getByte bh case b of 0 -> do (I# i#) <- get bh@@ -583,7 +583,7 @@ putByteArray :: BinHandle -> ByteArray# -> Int# -> IO () putByteArray bh a s# = loop 0#- where loop n#+ where loop n# | n# ==# s# = return () | otherwise = do putByte bh (indexByteArray a n#)@@ -591,11 +591,11 @@ getByteArray :: BinHandle -> Int -> IO ByteArray getByteArray bh (I# sz) = do- (MBA arr) <- newByteArray sz+ (MBA arr) <- newByteArray sz let loop n | n ==# sz = return () | otherwise = do- w <- getByte bh+ w <- getByte bh writeByteArray arr n w loop (n +# 1#) loop 0#@@ -653,7 +653,7 @@ seekBin bh p -- skip over the object for now return a -+ {- --------------------------------------------------------- -- Reading and writing FastStrings@@ -666,7 +666,7 @@ -- Note: the length of the FastString is *not* the same as -- the size of the ByteArray: the latter is rounded up to a -- multiple of the word size.-+ {- -- possible faster version, not quite there yet: getFS bh@BinMem{} = do (I# l) <- get bh@@ -682,7 +682,7 @@ {- instance Binary FastString where put_ bh f@(FastString id l ba) =- case getUserData bh of {+ case getUserData bh of { UserData { ud_next = j_r, ud_map = out_r, ud_dict = dict} -> do out <- readIORef out_r let uniq = getUnique f@@ -696,7 +696,7 @@ } put_ bh s = error ("Binary.put_(FastString): " ++ show (unpackFS s)) - get bh = do+ get bh = do j <- get bh return $! (ud_dict (getUserData bh) ! j) -}@@ -709,4 +709,4 @@ a <- fromPackedStringIO ps return a put_ bh a = put_ bh (toPackedString a)--}+-}
code/README.txt view
@@ -1,3 +1,3 @@-This directory contains various modules which are associated with deriving+This directory contains various modules which are assosiated with deriving rules. They may either be used as-is or some may require modification or have a suitable replacement in the standard libraries already.
docs/drift.info view
@@ -1,4 +1,4 @@-This is docs/drift.info, produced by makeinfo version 4.11 from+This is docs/drift.info, produced by makeinfo version 4.13 from ./docs/drift.texi. INFO-DIR-SECTION Haskell Tools@@ -91,7 +91,6 @@ obtainable by running `DrIFT -l'. - Binary: Binary efficient binary encoding of terms GhcBinary byte sized binary encoding of terms@@ -815,27 +814,27 @@ Node: Introduction541 Node: What does DrIFT do?1355 Node: Features1879-Node: Motivation4392-Node: An Example6314-Node: Source Code6872-Node: After processing with DrIFT7693-Node: User Guide12794-Node: Command Line13817-Node: Command Syntax14423-Node: Emacs DrIFT mode16814-Node: Standard Rules17630-Node: User-Defined Rules20819-Node: The Basic Idea21945-Node: How is a Type Represented?22507-Node: Pretty Printing25404-Node: Utilities26187-Node: Adding a new rule26627-Node: Installation27087-Node: GHC27544-Node: Hugs27897-Node: Runhugs28158-Node: Environment Variables28488-Node: Installing the Emacs DrIFT Mode29130-Node: Bugs29562+Node: Motivation4391+Node: An Example6313+Node: Source Code6871+Node: After processing with DrIFT7692+Node: User Guide12793+Node: Command Line13816+Node: Command Syntax14422+Node: Emacs DrIFT mode16813+Node: Standard Rules17629+Node: User-Defined Rules20818+Node: The Basic Idea21944+Node: How is a Type Represented?22506+Node: Pretty Printing25403+Node: Utilities26186+Node: Adding a new rule26626+Node: Installation27086+Node: GHC27543+Node: Hugs27896+Node: Runhugs28157+Node: Environment Variables28487+Node: Installing the Emacs DrIFT Mode29129+Node: Bugs29561 End Tag Table
src/DataP.lhs view
@@ -12,8 +12,6 @@ >import ParseLib2 >import Data.Char >import Data.List->import Control.Monad- >data Statement = DataStmt | NewTypeStmt deriving (Eq,Show) >data Data = D { name :: Name, -- type name
src/DrIFT.hs view
@@ -7,18 +7,17 @@ import DataP import GenUtil import GetOpt-import Data.Char-import System.IO-import Control.Exception (try) import Data.List (partition,isSuffixOf,sort, groupBy, sortBy)-import Control.Monad (unless)-import PreludData (preludeData)+import Control.Monad(unless)+import PreludData(preludeData) import Pretty import RuleUtils (commentLine,texts) import RuleUtils(Rule,Tag) import Version import qualified Rules(rules)-import qualified System.Environment as System+import System.IO+import System.Environment+import Data.Char data Op = OpList | OpDerive | OpVersion @@ -79,7 +78,7 @@ header = "Usage: DrIFT [OPTION...] file" main = do- argv <- System.getArgs+ argv <- getArgs (env,n) <- case (getOpt Permute options argv) of (as,n,[]) -> return (foldr ($) env as ,n) (_,_,errs) -> putErrDie (concat errs ++ usageInfo header options)
src/GenUtil.hs view
@@ -39,7 +39,7 @@ -- ** Simple deconstruction fromLeft,fromRight,fsts,snds,splitEither,rights,lefts, -- ** System routines- exitSuccess, System.exitFailure, epoch, lookupEnv,endOfTime,+ exitSuccess, exitFailure, epoch, lookupEnv,endOfTime, -- ** Random routines repMaybe, liftT2, liftT3, liftT4,@@ -91,16 +91,17 @@ UniqueProducer(..) ) where +import System.Time+import System.IO+import System.IO.Error+import System.Exit(exitFailure, exitWith, ExitCode(..))+import System.Environment+import Control.Monad(join, liftM, MonadPlus, mzero)+import System.Random(StdGen, newStdGen, Random(randomR)) import Data.Char(isAlphaNum, isSpace, toLower, ord) import Data.List(group,sort) import Data.List(intersperse, sortBy, groupBy)-import Control.Monad-import qualified System.IO as IO-import System.IO.Error-import qualified System.Exit as System-import qualified System.Environment as Env-import System.Random(StdGen, newStdGen, Random(randomR))-import System.Time+-- import Random(StdGen, newStdGen, Random(randomR)) {-# SPECIALIZE snub :: [String] -> [String] #-} {-# SPECIALIZE snub :: [Int] -> [Int] #-}@@ -129,7 +130,7 @@ -- | write string to standard error putErr :: String -> IO ()-putErr = IO.hPutStr IO.stderr+putErr = System.IO.hPutStr System.IO.stderr -- | write string and newline to standard error putErrLn :: String -> IO ()@@ -139,13 +140,13 @@ -- | write string and newline to standard error, -- then exit program with failure. putErrDie :: String -> IO a-putErrDie s = putErrLn s >> System.exitFailure+putErrDie s = putErrLn s >> exitFailure -- | exit program successfully. 'exitFailure' is -- also exported from System. exitSuccess :: IO a-exitSuccess = System.exitWith System.ExitSuccess+exitSuccess = exitWith ExitSuccess {-# INLINE fromRight #-}@@ -219,6 +220,16 @@ repeatM_ :: Monad m => m a -> m () repeatM_ x = sequence_ $ repeat x +{-# INLINE replicateM #-}+{-# SPECIALIZE replicateM :: Int -> IO a -> IO [a] #-}+replicateM :: Monad m => Int -> m a -> m [a]+replicateM n x = sequence $ replicate n x++{-# INLINE replicateM_ #-}+{-# SPECIALIZE replicateM_ :: Int -> IO a -> IO () #-}+replicateM_ :: Monad m => Int -> m a -> m ()+replicateM_ n x = sequence_ $ replicate n x+ {-# SPECIALIZE maybeToMonad :: Maybe a -> IO a #-} -- | convert a maybe to an arbitrary failable monad maybeToMonad :: Monad m => Maybe a -> m a@@ -373,7 +384,7 @@ -- | looks up an enviornment variable and returns it in a 'MonadPlus' rather -- than raising an exception if the variable is not set. lookupEnv :: MonadPlus m => String -> IO (m String)-lookupEnv s = catch (fmap return $ Env.getEnv s) (\e -> if isDoesNotExistError e then return mzero else ioError e)+lookupEnv s = catch (fmap return $ getEnv s) (\e -> if isDoesNotExistError e then return mzero else ioError e) {-# SPECIALIZE fmapLeft :: (a -> c) -> [(Either a b)] -> [(Either c b)] #-} fmapLeft :: Functor f => (a -> c) -> f (Either a b) -> f (Either c b)@@ -474,7 +485,7 @@ _ `overlaps` _ = True -- | translate a number of seconds to a string representing the duration expressed.-showDuration :: Integral a => a -> String+showDuration :: (Show a,Integral a) => a -> String showDuration x = st "d" dayI ++ st "h" hourI ++ st "m" minI ++ show secI ++ "s" where (dayI, hourI) = divMod hourI' 24 (hourI', minI) = divMod minI' 60@@ -487,7 +498,7 @@ -- arguments are given, read stdin. getArgContents = do- as <- Env.getArgs+ as <- getArgs let f "-" = getContents f fn = readFile fn cs <- mapM f as
src/Rules.hs view
@@ -1,5 +1,7 @@-module Rules (rules) where+-- Generated by collect_rules.sh +module Rules(rules) where+ import qualified Rules.Arbitrary import qualified Rules.Binary import qualified Rules.BitsBinary@@ -11,15 +13,15 @@ import qualified Rules.Utility import qualified Rules.Xml -rules = concat [- Rules.Arbitrary.rules,- Rules.Binary.rules,- Rules.BitsBinary.rules,- Rules.FunctorM.rules,- Rules.Generic.rules,- Rules.GhcBinary.rules,- Rules.Monoid.rules,- Rules.Standard.rules,- Rules.Utility.rules,- Rules.Xml.rules- ]+rules = concat+ [Rules.Arbitrary.rules+ ,Rules.Binary.rules+ ,Rules.BitsBinary.rules+ ,Rules.FunctorM.rules+ ,Rules.Generic.rules+ ,Rules.GhcBinary.rules+ ,Rules.Monoid.rules+ ,Rules.Standard.rules+ ,Rules.Utility.rules+ ,Rules.Xml.rules+ ]
src/Rules/Monoid.hs view
@@ -1,7 +1,6 @@ -- stub module to add your own rules. module Rules.Monoid (rules) where -import Data.List import RuleUtils rules = [
src/Rules/Utility.hs view
@@ -1,6 +1,5 @@ module Rules.Utility(rules) where import RuleUtils-import Data.List import GenUtil rules :: [RuleDef]
src/Unlit.hs view
@@ -4,7 +4,6 @@ -- "Report on the Programming Language Haskell", -- version 1.2, appendix C. - import Data.Char data Classified = Program String | Blank | Comment