packages feed

nemesis 2009.10.7 → 2010.10.4

raw patch · 4 files changed

+59/−27 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

LICENSE view
@@ -1,9 +1,31 @@ Copyright (c) 2009, Jinjing Wang+ All rights reserved. -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:+Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met: -Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.-Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.-Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of Jinjing Wang nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
nemesis.cabal view
@@ -1,13 +1,13 @@ Name:                 nemesis-Version:              2009.10.7+Version:              2010.10.4 Build-type:           Simple Synopsis:             a Rake like task management tool Description:          smart per project code snippets  License:              BSD3 License-file:         LICENSE-Author:               Wang, Jinjing-Maintainer:           Wang, Jinjing <nfjinjing@gmail.com>+Author:               Jinjing Wang+Maintainer:           Jinjing Wang <nfjinjing@gmail.com> Build-Depends:        base Cabal-version:        >= 1.2 category:             Web
readme.md view
@@ -100,9 +100,9 @@ Advance usage ------------- -### Use LANGUAGE+### Use LANGUAGE progam -Use a separator below language extensions, e.g.+Put a `-- Nem` token after the `Langauge` progma      {-# LANGUAGE QuasiQuotes #-} @@ -113,10 +113,12 @@  currently the separator `-- Nem` is hard coded -### Build it yourself+### By pass preprocessing, e.g. use custom imports -If you don't want `nemesis` to compile `Nemesis` through intermediate `nemesis-tmp.hs` file, rename your `Nemesis` to `Nemesis.hs`, then start with this template.+Define `main`, i.e. add `main = run nemesis` in the code. The preprocessor look for the function main, if it's defined, it skip preprocessing, and Nemesis because pure EDSL that can be run by `runhaskell`. +For example:+     import System.Nemesis (run)     import System.Nemesis.DSL     import MPS.Light ((-))@@ -127,10 +129,13 @@              main = run nemesis -The logic is that whenever `main` is defined in `Nemesis.hs`, `nemesis` will act as `ghc --make` wrapper, so you can get nice error messages.+Test out by: -### That's it!+  runghc Nemesis ++### Who is mnemosyne?+ ![mnemosyne](http://github.com/nfjinjing/nemesis/raw/master/mnemosyne.jpg) -OK, she's actually mnemosyne, a cool goddess none the less.+OK, I made a mistake in the project name, but she's a cool goddess none the less.
src/System/Nemesis/Runner.hs view
@@ -9,6 +9,7 @@ import System.Time import System.Nemesis.DSL import qualified Prelude as P+import Data.Maybe   start, end :: String@@ -61,20 +62,22 @@       src_hi = src_base_name src_name ++ ".hi"   src <- readFile src_name   -  let patch_end   = patch_src main_src src end-      patch_start = patch_src main_src src start-      h = src.lines.takeWhile (lower > starts_with sep > not) .unlines-      t = src.lines.dropWhile (lower > starts_with sep > not) .unlines+  let maybe_patch_end   = yield_string_if_no_line_starts_with     main_src_prefix src end+      maybe_patch_start = yield_string_if_no_line_starts_with     main_src_prefix src start+      +      __nem_seperated_header = src.lines.takeWhile (lower > starts_with sep > not) .unlines+      __nem_seperated_footer = src.lines.dropWhile (lower > starts_with sep > not) .unlines -  if ((patch_end ++ patch_start).null && src_name.ends_with ".hs")+  if (maybe_patch_end.isNothing && maybe_patch_start.isNothing && src_name.ends_with ".hs")     then do       sh - "ghc --make -O1 " ++ src_name ++ " -o " ++ bin       rm src_o       rm src_hi     else do-      if t.null-        then output_tmp - patch_start ++ h ++ patch_end-        else output_tmp - h ++ patch_start ++ "\n" ++ t ++ patch_end+      if __nem_seperated_footer.null+        then output_tmp - maybe_patch_start.fromMaybe "" ++ __nem_seperated_header ++ maybe_patch_end.fromMaybe ""+        else output_tmp - __nem_seperated_header ++ maybe_patch_start.fromMaybe "" ++ "\n" ++ __nem_seperated_footer ++ maybe_patch_end.fromMaybe ""+               sh - "ghc --make -O1 " ++ tmp_name ++ " -o " ++ bin       rm tmp_name       rm tmp_o@@ -82,7 +85,8 @@      where -    main_src        = "main ="+    main_src_prefix = "main ="+         sep             = "-- nem"     output_tmp      = writeFile tmp_name     tmp_name        = "nemesis-tmp.hs"@@ -92,8 +96,9 @@     src_base_name s = if s.ends_with ".hs"                          then s.reverse.drop 3.reverse                         else s-    patch_src l s p = case s.lines.find (starts_with l) of-                        Nothing -> p-                        Just _ -> ""+                        +    yield_string_if_no_line_starts_with prefix str yield = case str.lines.find (starts_with prefix) of+                        Nothing -> Just yield+                        Just _ -> Nothing