DrIFT-cabalized 2.2.3.3 → 2.2.4
raw patch · 7 files changed
+194/−225 lines, 7 files
Files
- DrIFT-cabalized.cabal +2/−2
- README +0/−55
- README.md +22/−0
- docs/drift.info +156/−161
- src/ChaseImports.hs +1/−1
- src/GenUtil.hs +12/−5
- src/Version.hs +1/−1
DrIFT-cabalized.cabal view
@@ -1,5 +1,5 @@ name: DrIFT-cabalized-version: 2.2.3.3+version: 2.2.4 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@@ -23,7 +23,7 @@ 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.md, 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,
− README
@@ -1,55 +0,0 @@--------------------------------------------------------------------------------- DrIFT--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/-----------------------------------------------------------------------------------Contents of this package:-- - src Directory with the source files of the DrIFT tool- - example Directory with examples of using the DrIFT tool- - docs Documentation-----------------------------------------------------------------------------------To configure and install DrIFT from the source tarball-- ./configure --prefix=<dir>- make install--Where <dir> is the directory in which you want to install the tool. Note that-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---If you have pulled the source from the darcs repository, you must first build-the autotools scripts by running-- autoreconf -i------------------------------------------------------------------------------------You may optionally sset DERIVEPATH to the list of directories you wish to search for-modules.--as an example:--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-
+ README.md view
@@ -0,0 +1,22 @@+# DrIFT-cabalized [](https://travis-ci.org/ajhc/drift)++This package contains a source distribution of DrIFT, a tool for automatic+derivation of Haskell class instances. DrIFT was formerly known as Derive.++The original homepage is at+[http://repetae.net/john/computer/haskell/DrIFT/](http://repetae.net/john/computer/haskell/DrIFT/).+But DrIFT-cabalized package has some changes with original DrIFT.++## Contents of this package:++* src: Directory with the source files of the DrIFT tool+* example: Directory with examples of using the DrIFT tool+* docs: Documentation++## How to install++To configure and install DrIFT from the source tarball++ $ autoreconf -i+ $ ./configure+ $ make cabal-install
docs/drift.info view
@@ -1,5 +1,4 @@-This is docs/drift.info, produced by makeinfo version 4.13 from-./docs/drift.texi.+This is drift.info, produced by makeinfo version 5.1 from drift.texi. INFO-DIR-SECTION Haskell Tools START-INFO-DIR-ENTRY@@ -36,12 +35,12 @@ DrIFT is a tool which parses a Haskell module for structures (data & newtype declarations) and commands. These commands cause rules to be fired on the parsed data, generating new code which is then appended to-the bottom of the input file, or redirected to another. These rules are+the bottom of the input file, or redirected to another. These rules are expressed as Haskell code, and it is intended that the user can add new rules as required. DrIFT is written in pure Haskell 98, however code it generates is-free to make use of extensions when appropriate. DrIFT is currently+free to make use of extensions when appropriate. DrIFT is currently tested against hugs and ghc. * Menu:@@ -58,11 +57,11 @@ =========================== DrIFT allows derivation of instances for classes that aren't supported-by the standard compilers. In addition, instances can be produced in+by the standard compilers. In addition, instances can be produced in separate modules to that containing the type declaration. This allows instances to be derived for a type after the original module has been-compiled. As a bonus, simple utility functions can also be produced-for types.+compiled. As a bonus, simple utility functions can also be produced for+types. File: drift.info, Node: Features, Next: Motivation, Prev: What does DrIFT do?, Up: Introduction@@ -73,7 +72,7 @@ * DrIFT comes with a set of rules to produce instances for all derivable classes given in the Prelude. There's a rule to produce instances of NFData (the original motivation of all this), and- rules for utility functions on types also. The DrIFT+ rules for utility functions on types also. The DrIFT implementation is also regularly updated with rules submitted by users. @@ -87,8 +86,8 @@ Haskell themselves, the user doesn't have to learn a new language syntax, and can use all Haskell's features. - Currently supported derivations are the following. This list is-obtainable by running `DrIFT -l'.+ Currently supported derivations are the following. This list is+obtainable by running 'DrIFT -l'. Binary:@@ -129,6 +128,7 @@ update for label 'foo' provides 'foo_u' to update it and foo_s to set it + File: drift.info, Node: Motivation, Next: An Example, Prev: Features, Up: Introduction @@ -137,10 +137,10 @@ The original motivation for DrIFT came from reading one of the Glasgow Parallel Haskell papers on Strategies. Strategies require producing-instances of a class which reduces to normal form (called NFData). It+instances of a class which reduces to normal form (called NFData). It was commented that it was a shame that instances of NFData couldn't be automatically derived; the rules to generate the instances are simple,-and adding instances by hand is tiresome. Many classes' instances+and adding instances by hand is tiresome. Many classes' instances follow simple patterns. This is what makes coding up instances so tedious: there's no thought involved! @@ -153,19 +153,19 @@ already several times to me that I needed a standard instance of a data type that I imported from a module that did not provide that instance and which I did not want to change (a library; GHC, which- I mainly want to extend by further modules, not spread changes- over 250 modules). When declaring a new data type one normally- avoids deriving (currently) unneeded instances, because it costs- program code (and maybe one even wants to enable the user of the- module to define his own instances).+ I mainly want to extend by further modules, not spread changes over+ 250 modules). When declaring a new data type one normally avoids+ deriving (currently) unneeded instances, because it costs program+ code (and maybe one even wants to enable the user of the module to+ define his own instances). - The third feature of DrIFT, providing utility functions to-manipulate new types, especially records was caused by finding oneself-writing the same sort of code over and over again. These functions-couldn't be captured in a class, but have a similar form for each type-they are defined on. A thread on the Haskell mailing list made a-related point: untagging and manipulating newtypes was more cumbersome-than it should be.+ The third feature of DrIFT, providing utility functions to manipulate+new types, especially records was caused by finding oneself writing the+same sort of code over and over again. These functions couldn't be+captured in a class, but have a similar form for each type they are+defined on. A thread on the Haskell mailing list made a related point:+untagging and manipulating newtypes was more cumbersome than it should+be. File: drift.info, Node: An Example, Prev: Motivation, Up: Introduction@@ -175,10 +175,10 @@ Here's an example of what how DrIFT is used. This Haskell module contains commands to the DrIFT preprocessor. These are annotated with-`{-! ... !-}'. After processing with DrIFT the generated code is-glued on the bottom of the file, beneath a marker indicating where the-new code starts. The machine generated code is quite long, and would-really have been a drudge to type in by hand.+'{-! ... !-}'. After processing with DrIFT the generated code is glued+on the bottom of the file, beneath a marker indicating where the new+code starts. The machine generated code is quite long, and would really+have been a drudge to type in by hand. * Menu: @@ -345,27 +345,24 @@ ************ This chapter assumes that DrIFT has already been installed and the-environment variables set up. The installation is handled in *note+environment variables set up. The installation is handled in *note Installation::. Briefly, the way DrIFT works is 1. parse the input file, looking for commands and data & newtype statements.- 2. generate code by executing the commands, which apply rules to types.- 3. if any commands remain unexecuted, this means the types aren't declared in this module, so DrIFT searches for them in imported modules.- 4. append the generated code to the bottom of the file (overwriting any previously generated code) - Rules can be applied to any types defined using a `data' or-`newtype' statement. Rules can't be applied to types defined using-`type', as this only produces a synonym for a type. *Don't try to use-rules on type synonyms.*+ Rules can be applied to any types defined using a 'data' or 'newtype'+statement. Rules can't be applied to types defined using 'type', as+this only produces a synonym for a type. *Don't try to use rules on+type synonyms.* * Menu: @@ -379,19 +376,19 @@ 2.1 The Command Line ==================== -DrIFT processes standard Haskell scripts (suffix `.hs') and literate-scripts (suffix `.lhs'). Currently, only literate code using `>' is-accepted: DrIFT doesn't understand the TeX style of literate-programming using `\begin{code}'.+DrIFT processes standard Haskell scripts (suffix '.hs') and literate+scripts (suffix '.lhs'). Currently, only literate code using '>' is+accepted: DrIFT doesn't understand the TeX style of literate programming+using '\begin{code}'. If you've compiled up an executable from the source code (or are using Runhugs) to run DrIFT over a file type :- - `DrIFT FILENAME'+ 'DrIFT FILENAME' Alternatively, for Hugs, use :- - `runhugs DrIFT FILENAME' (run DrIFT over filename)+ 'runhugs DrIFT FILENAME' (run DrIFT over filename) File: drift.info, Node: Command Syntax, Next: Emacs DrIFT mode, Prev: Command Line, Up: User Guide@@ -400,27 +397,27 @@ ================== Commands to DrIFT are entered into Haskell code in the form of-_annotations_. DrIFT's annotations start with `{-!' and finish with-`!-}'. (This is so they don't clash with the compiler annotations given-to GHC or HBC). There are three forms of command.+_annotations_. DrIFT's annotations start with '{-!' and finish with+'!-}'. (This is so they don't clash with the compiler annotations given+to GHC or HBC). There are three forms of command. - * *Stand-Alone Command* (syntax : `{-! for TYPE derive :+ * *Stand-Alone Command* (syntax : '{-! for TYPE derive : RULE1,RULE2,... !-}') This is the basic form of DrIFT command. It- asks DrIFT to apply the listed rules to the specified type. If- the type is parameterised, e.g. `Maybe a', just enter the type- name into the command, omitting any type variables. DrIFT assumes- that types given are currently in scope, and will first search the+ asks DrIFT to apply the listed rules to the specified type. If the+ type is parameterised, e.g. 'Maybe a', just enter the type name+ into the command, omitting any type variables. DrIFT assumes that+ types given are currently in scope, and will first search the current module. If it fails to find a matching type definition, the prelude and any imported modules are also searched. This is the only command which allows code to be generated for a type defined in another module. - * *Abbreviated Command* (syntax : `{-! derive :RULE1,RULE2,... !-}')- This command is appended to the end of a `data' or `newtype'+ * *Abbreviated Command* (syntax : '{-! derive :RULE1,RULE2,... !-}')+ This command is appended to the end of a 'data' or 'newtype' definition, after the deriving clause, if present. It applies the listed rules to the type it is attached to. - * *Global Command* (syntax : `{-! global :RULE1,RULE2,... !-}' This+ * *Global Command* (syntax : '{-! global :RULE1,RULE2,... !-}' This command applies the listed rules to all types defined within the module. Note that this command doesn't cause code to be generated for types imported from other modules.@@ -432,17 +429,17 @@ * The stand-alone and global commands should be entered on a line by themselves, starting in the first column, (as with other top-level- declarations, such as `infix', `import',`newtype'). It doesn't+ declarations, such as 'infix', 'import','newtype'). It doesn't matter what position they occur within the module. - * In a literate file, all commands should be entered on a `code'- line (one starting with `>').+ * In a literate file, all commands should be entered on a 'code' line+ (one starting with '>'). - * Commands may be commented out by using `--' and `{- .. -}' in the+ * Commands may be commented out by using '--' and '{- .. -}' in the usual way. * If two commands apply the same rule to a type, then two sets of- identical code will be produced. This will cause a `multiple+ identical code will be produced. This will cause a 'multiple definition' error when the processed module is compiled/interpreted. *Don't do it!* @@ -456,19 +453,20 @@ script which allows DrIFT to be run within a buffer. The commands available are- * `M-x hwl-derive', `C-c d d' runs DrIFT over the current buffer,- and then updates the buffer. - * `M-x hwl-derive-insert-standalone', `C-c d s' inserts a template+ * 'M-x hwl-derive', 'C-c d d' runs DrIFT over the current buffer, and+ then updates the buffer.++ * 'M-x hwl-derive-insert-standalone', 'C-c d s' inserts a template for a standalone command into the current buffer at the cursor position. - * `M-x hwl-derive-insert-local', `C-c d l' inserts a template for an+ * 'M-x hwl-derive-insert-local', 'C-c d l' inserts a template for an abbreviated command. - * `M-x hwl-derive-insert-global', `C-c d g' inserts a template for a+ * 'M-x hwl-derive-insert-global', 'C-c d g' inserts a template for a global command- In `hugs-mode' these functions are also available vie a menu item in+ In 'hugs-mode' these functions are also available vie a menu item in the hugs menu. @@ -477,11 +475,11 @@ 3 Standard Rules **************** -Heres a listing of the rules that come pre-defined with DrIFT. If you+Heres a listing of the rules that come pre-defined with DrIFT. If you want a more detailed idea of how they work, their definitions are in the-file `StandardRules.hs', and are (fairly) well documented. In the+file 'StandardRules.hs', and are (fairly) well documented. In the following list the *highlighted* text is the name of the rule, as used-in commands. The naming convention for rules is names starting with a+in commands. The naming convention for rules is names starting with a capital generate an instance for the class of the same name. Sets of functions are generated by a name beginning with a lower case letter. @@ -489,70 +487,69 @@ =================== The classes *Eq*, *Ord*, *Enum*, *Show*, *Read* & *Bounded* are-described in the Haskell report as being derivable; DrIFT provides-rules for all these.+described in the Haskell report as being derivable; DrIFT provides rules+for all these. 3.2 Other Classes ================= Originally, *NFData* (for Normal Form evaluation strategies) was the-only other class to have a rule. But now, there are rules for many-more classes from 3rd-party libraries, e.g. *XmlContent* from HaXml,+only other class to have a rule. But now, there are rules for many more+classes from 3rd-party libraries, e.g. *XmlContent* from HaXml, *Binary* from nhc98, *Term* from Strafunski, *FunctorM* for Generics, *Observable* for HOOD debugging, *Typeable* for dynamics, and so on.-For a full list, use the `--list' command-line option.+For a full list, use the '--list' command-line option. 3.3 Utilities ============= * *un* attempts to make newtypes a little nicer to use by providing an untagging function. This rule can only be used on types defined- using `newtype'.+ using 'newtype'. - For a type `newtype Foo a = F a',+ For a type 'newtype Foo a = F a', - *un* produces the function `unFoo :: Foo a -> a'.+ *un* produces the function 'unFoo :: Foo a -> a'. * *is* produces predicates that indicate the presence of a constructor. This is only useful for multi-constructor datatypes (obviously). - For a type `data Foo = Bar | Bub', *is* generates+ For a type 'data Foo = Bar | Bub', *is* generates - `isBar :: Foo -> Bool' and `isBub :: Foo -> Bool'.+ 'isBar :: Foo -> Bool' and 'isBub :: Foo -> Bool'. * *has* produces predicates that indicate the presence of a label. This can only be used with types where at least one of the constructors is a labelled record. Note that labels can be shared between constructors of the same type. - For a type `data Foo a = F{bar :: a,bub :: Int}' *has*+ For a type 'data Foo a = F{bar :: a,bub :: Int}' *has* generates - `hasbar :: Foo a-> Bool' and `hasbub :: Foo a -> Bool'.+ 'hasbar :: Foo a-> Bool' and 'hasbub :: Foo a -> Bool'. * *update* produces functions that update fields within a record type. This rule can only be used with a type where at least on of the constructors is a labelled record. - For a type `data Foo a = F{bar :: a, bub ::Int}' *update*+ For a type 'data Foo a = F{bar :: a, bub ::Int}' *update* generates - `bar_u :: (a -> a) -> Foo a -> Foo a' and+ 'bar_u :: (a -> a) -> Foo a -> Foo a' and - `bub_u :: (Int -> Int) -> Foo a -> Foo a' which apply a+ 'bub_u :: (Int -> Int) -> Foo a -> Foo a' which apply a function to a field of a record, and then return the updated- record. If the value does not have the given field then the+ record. If the value does not have the given field then the value is returned unchanged. - `bar_s :: a -> Foo a -> Foo a' and `bub_s ::Int -> Foo a ->- Foo a' are also generated, and are used to set the value of- a field in a record.-- * *test* dumps the parsed representation of a datatype to the- output. This is be useful for debugging new rules, as the user- can see what information is stored about a particular type.+ 'bar_s :: a -> Foo a -> Foo a' and 'bub_s ::Int -> Foo a ->+ Foo a' are also generated, and are used to set the value of a+ field in a record. + * *test* dumps the parsed representation of a datatype to the output.+ This is be useful for debugging new rules, as the user can see what+ information is stored about a particular type. File: drift.info, Node: User-Defined Rules, Next: Installation, Prev: Standard Rules, Up: Top@@ -563,16 +560,16 @@ Programmers who only wish to use the pre-defined rules in DrIFT don't need to read or understand the following section. However, as well as using the supplied rules, users are encouraged to add their own. There-is a stub module `UserRules.hs' in the source, to which rules can be+is a stub module 'UserRules.hs' in the source, to which rules can be added. If a compiled version of DrIFT is being used, the program will then have to be recompiled before the new rules can be used. However, if the Runhugs standalone interpreter is used, this is not necessary. Due to the way Runhugs searches for modules to load, a user may have many-copies of the UserRules module. The UserRules module in the current+copies of the UserRules module. The UserRules module in the current directory will be loaded first. If that is not present, then the-`HUGSPATH' environment variable is searched for the module. So it is+'HUGSPATH' environment variable is searched for the module. So it is possible to have a default UserRules module, and specialised ones for particular projects. @@ -590,12 +587,12 @@ 4.1 The Basic Idea ================== -A rule is a tuple containing a string and a function. The string is the-name of the rule, and is used in commands in an input file. The+A rule is a tuple containing a string and a function. The string is the+name of the rule, and is used in commands in an input file. The function maps between the abstract representation of a datatype and text-to be output (A sort of un-parser, if you like). The best way to+to be output (A sort of un-parser, if you like). The best way to understand this is to have a look at the existing rules in-`StandardRules.hs'. This module is quite well documented.+'StandardRules.hs'. This module is quite well documented. File: drift.info, Node: How is a Type Represented?, Next: Pretty Printing, Prev: The Basic Idea, Up: User-Defined Rules@@ -619,29 +616,29 @@ >type Var = String >type Class = String - A `Data' type represents one parsed `data' or `newtype' statement.-These are held in a `D' constructor record (the `Directive' and-`TypeName' constructors are just used internally by DrIFT). We'll now+ A 'Data' type represents one parsed 'data' or 'newtype' statement.+These are held in a 'D' constructor record (the 'Directive' and+'TypeName' constructors are just used internally by DrIFT). We'll now examine each of the fields in turn. - * `name' holds the name of the new datatype as a string.+ * 'name' holds the name of the new datatype as a string. - * `constraints' list the type constraints for the type variables of- the new type. e.g. for `data (Eq a) => Foo a = F a', the value of- `constraints' would be `[("Eq","a")]'.+ * 'constraints' list the type constraints for the type variables of+ the new type. e.g. for 'data (Eq a) => Foo a = F a', the value of+ 'constraints' would be '[("Eq","a")]'. - * `vars' contains a list of the type variables in the type. For the- previous example, this would simply be `["a"]' .+ * 'vars' contains a list of the type variables in the type. For the+ previous example, this would simply be '["a"]' . - * `body' is a list of the constructors of the type, and the+ * 'body' is a list of the constructors of the type, and the information associated with them. We'll come back to this in a moment. - * `derives' lists the classes that the type an instance of though- using the `deriving' clause.+ * 'derives' lists the classes that the type an instance of though+ using the 'deriving' clause. - * `statement' indicates whether the type was declared using a- `newtype' or `data' statement+ * 'statement' indicates whether the type was declared using a+ 'newtype' or 'data' statement 4.2.1 The Body --------------@@ -653,10 +650,10 @@ >type Constructor = String The body type holds information about one of the constructors of a-type. `constructor' is self-explanatory. `labels' holds the names of+type. 'constructor' is self-explanatory. 'labels' holds the names of labels of a record. This will be blank if the constructor isn't a-record. `types' contains a representation of the type of each value-within the constructor. The definition of `Type' is as follows.+record. 'types' contains a representation of the type of each value+within the constructor. The definition of 'Type' is as follows. >data Type = Arrow Type Type -- fn > | Apply Type Type -- application@@ -676,14 +673,14 @@ =================== Instead of producing a string as output, rules produce a value of type-`Doc'. This type is defined in the Pretty Printing Library implemented+'Doc'. This type is defined in the Pretty Printing Library implemented by Simon Peyton-Jones. The pretty printer ensures that the code is formatted for readability, and also handles problems such as indentation. Constructing output using pretty printing combinators is-easier and more structured than manipulating strings too. For those+easier and more structured than manipulating strings too. For those unfamiliar with these combinators, have a look at the module-`Pretty.lhs' and the web page `http://www.cse.ogi.edu/~simonpj/' or for-more detail the paper `The Design of a Pretty Printing Library, J.+'Pretty.lhs' and the web page <http://www.cse.ogi.edu/~simonpj/> or for+more detail the paper 'The Design of a Pretty Printing Library, J. Hughes' @@ -694,8 +691,8 @@ Upon the pretty printing library, DrIFT defines some more formatting functions which make regularly occurring structures of code easier to-write. These structures include simple instances, blocks of code,-lists, etc. The utilities are in the module `RuleUtils.hs' and should+write. These structures include simple instances, blocks of code,+lists, etc. The utilities are in the module 'RuleUtils.hs' and should be self explanatory. @@ -704,10 +701,10 @@ 4.5 Adding a new rule ===================== -A rule has type `type Rule = (String,Data -> Doc)'. Once you have+A rule has type 'type Rule = (String,Data -> Doc)'. Once you have written your mapping function and chosen an appropriate name for the-rule, add this tuple to the list `userRules :: [Rule]' in module-`UserRules.hs'. Recompile if necessary. DrIFT will then call this rule+rule, add this tuple to the list 'userRules :: [Rule]' in module+'UserRules.hs'. Recompile if necessary. DrIFT will then call this rule when its name occurs in a command in an input file. @@ -736,9 +733,9 @@ ======= the automake script should automatically detect any ghc or nhc-installation and use that to build and install DrIFT. First run-`./configure' . To compile, type `make all'. The executable produced-`DrIFT' can then be installed with `make install'.+installation and use that to build and install DrIFT. First run+'./configure' . To compile, type 'make all'. The executable produced+'DrIFT' can then be installed with 'make install'. File: drift.info, Node: Hugs, Next: Runhugs, Prev: GHC, Up: Installation@@ -747,7 +744,7 @@ ======== The DrIFT code comes as a set of Haskell modules. You want to copy all-these to somewhere in your `HUGSPATH', then you can load and run DrIFT+these to somewhere in your 'HUGSPATH', then you can load and run DrIFT in any directory. @@ -756,9 +753,9 @@ 5.3 Runhugs =========== -Edit the first line of the the file `DrIFT' to point to your copy of-`runhugs'. Copy `DrIFT' to somewhere on your `PATH', and the remainder-of the source (`*.hs',`*.lhs') to a directory in your `HUGSPATH'+Edit the first line of the the file 'DrIFT' to point to your copy of+'runhugs'. Copy 'DrIFT' to somewhere on your 'PATH', and the remainder+of the source ('*.hs','*.lhs') to a directory in your 'HUGSPATH' File: drift.info, Node: Environment Variables, Next: Installing the Emacs DrIFT Mode, Prev: Runhugs, Up: Installation@@ -766,10 +763,10 @@ 5.4 Environment Variables ========================= -In you environment set `DERIVEPATH' to the list of directories you wish+In you environment set 'DERIVEPATH' to the list of directories you wish derive to search for modules / interfaces. - `DERIVEPATH' is quite fussy about the format the list should take :-+ 'DERIVEPATH' is quite fussy about the format the list should take :- * each path should be separated by ':' @@ -779,9 +776,9 @@ For instance - good - `/users/nww/share/hugs/lib:/users/nww/share/hugs/lib/hugs'+ good - '/users/nww/share/hugs/lib:/users/nww/share/hugs/lib/hugs' - bad - `/users/nww/share/hugs/lib/: /users/nww/share/hugs/lib/hugs/'+ bad - '/users/nww/share/hugs/lib/: /users/nww/share/hugs/lib/hugs/' File: drift.info, Node: Installing the Emacs DrIFT Mode, Prev: Environment Variables, Up: Installation@@ -789,12 +786,12 @@ 5.5 Installing the Emacs DrIFT Mode =================================== -Edit `derive.el' so that the variable `hwl-derive-cmd' contains your-copy of the DrIFT executable. Place `derive.el' into a directory on-your `load-path', byte-compile it and put the following command into-your `.emacs' file:+Edit 'derive.el' so that the variable 'hwl-derive-cmd' contains your+copy of the DrIFT executable. Place 'derive.el' into a directory on+your 'load-path', byte-compile it and put the following command into+your '.emacs' file: - `(load "derive")'+ '(load "derive")' File: drift.info, Node: Bugs, Prev: Installation, Up: Top@@ -803,34 +800,32 @@ *********************** * DrIFT doesn't check for commands applying the same rule to a type.- * No support for TeX-style literate code. - Tag Table:-Node: Top220-Node: Introduction541-Node: What does DrIFT do?1355-Node: Features1879-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: Top207+Node: Introduction528+Node: What does DrIFT do?1344+Node: Features1869+Node: Motivation4384+Node: An Example6306+Node: Source Code6863+Node: After processing with DrIFT7684+Node: User Guide12785+Node: Command Line13808+Node: Command Syntax14414+Node: Emacs DrIFT mode16807+Node: Standard Rules17624+Node: User-Defined Rules20811+Node: The Basic Idea21938+Node: How is a Type Represented?22503+Node: Pretty Printing25401+Node: Utilities26185 Node: Adding a new rule26626-Node: Installation27086-Node: GHC27543+Node: Installation27087+Node: GHC27544 Node: Hugs27896 Node: Runhugs28157 Node: Environment Variables28487
src/ChaseImports.hs view
@@ -30,7 +30,7 @@ import Control.Monad import GenUtil -try x = catch (x >>= return . Right) (return . Left)+try x = iocatch (x >>= return . Right) (return . Left) --- Split up input --------------------------------------------------------- splitString :: String -> String -> (String,String)
src/GenUtil.hs view
@@ -86,6 +86,7 @@ readsM, split, tokens,+ iocatch, -- * Classes UniqueProducer(..)@@ -93,10 +94,12 @@ import System.Time import System.IO-import System.IO.Error+import System.IO.Error(isDoesNotExistError)+import Control.Exception import System.Exit(exitFailure, exitWith, ExitCode(..))-import System.Environment+import System.Environment(getArgs, getEnv) import Control.Monad(join, liftM, MonadPlus, mzero)+import Prelude hiding (catch) import System.Random(StdGen, newStdGen, Random(randomR)) import Data.Char(isAlphaNum, isSpace, toLower, ord) import Data.List(group,sort)@@ -106,6 +109,10 @@ {-# SPECIALIZE snub :: [String] -> [String] #-} {-# SPECIALIZE snub :: [Int] -> [Int] #-} +-- | catch function only for IOException+iocatch :: IO a -> (IOException -> IO a) -> IO a+iocatch = catch+ -- | sorted nub of list, much more efficient than nub, but doesnt preserve ordering. snub :: Ord a => [a] -> [a] snub = map head . group . sort@@ -287,10 +294,10 @@ lefts xs = [x | Left x <- xs] ioM :: Monad m => IO a -> IO (m a)-ioM action = catch (fmap return action) (\e -> return (fail (show e)))+ioM action = iocatch (fmap return action) (\e -> return (fail (show e))) ioMp :: MonadPlus m => IO a -> IO (m a)-ioMp action = catch (fmap return action) (\_ -> return mzero)+ioMp action = iocatch (fmap return action) (\_ -> return mzero) -- | reformat a string to not be wider than a given width, breaking it up -- between words.@@ -384,7 +391,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 $ getEnv s) (\e -> if isDoesNotExistError e then return mzero else ioError e)+lookupEnv s = iocatch (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)
src/Version.hs view
@@ -2,7 +2,7 @@ package = "DrIFT" -version = "2.2.3"+version = "2.2.4" fullName = package ++ "-" ++ version