QuickAnnotate 0.1 → 0.2
raw patch · 3 files changed
+16/−5 lines, 3 files
Files
- QuickAnnotate.cabal +8/−4
- QuickAnnotate.hs +7/−0
- QuickAnnotate/Preprocessor.hs +1/−1
QuickAnnotate.cabal view
@@ -1,15 +1,19 @@ Name: QuickAnnotate-Version: 0.1+Version: 0.2 Synopsis: Annotation Framework-Homepage: darcs repository http://code.haskell.org/QuickAnnotate/+Homepage: http://code.haskell.org/QuickAnnotate/ License: BSD3 License-file: LICENSE Author: Shayan Najd Maintainer: sh.najd@gmail.com Category: Development Build-type: Simple-Cabal-version: >=1.2-description: A framework introducing annotation by preprocessing +Cabal-version: >=1.6+description: A framework introducing annotations by preprocessing. For using it, it is enough to derive 'QuickAnnotate.Annotatable' and then use the preprocessor (qapp). The package contains an example demonstrating this procedure. ++Source-repository head+ type: darcs+ location: http://code.haskell.org/QuickAnnotate Executable qapp Main-is: QuickAnnotate/Preprocessor.hs
QuickAnnotate.hs view
@@ -2,16 +2,23 @@ {-# LANGUAGE IncoherentInstances #-} {-# LANGUAGE OverlappingInstances #-} +-- | QuickAnnotate Module module QuickAnnotate where +-- | Type of source location data type Loc = String +-- |'Annotatable' is used for overloading the annotate function added by the preprocessor. class Annotatable a where annotate :: Loc -> a -> a +-- | By default all types that do not derive 'Annotatable' expilicitly are annotated by 'id'. instance Annotatable a where annotate _ = id +-- | The 'annotate' function ignores types of the arguments in a function (abstraction) and +-- annotates the returned value based on its type. For example: +-- 'annotate ( \x y -> x )' is equal to '\x y -> annotate x' instance Annotatable b => Annotatable (a -> b) where annotate l f = \x -> annotate l (f x)
QuickAnnotate/Preprocessor.hs view
@@ -17,7 +17,7 @@ _ -> putStrLn usageString usageString :: String-usageString = "Usage: pp <infile> [<outfile>]"+usageString = "Usage: qapp <infile> [<outfile>]" transformFile :: String -> String -> String -> IO ()