packages feed

pointfree 1.0.4.4 → 1.0.4.5

raw patch · 5 files changed

+32/−28 lines, 5 filesdep +transformersdep −mtldep ~haskell-src-exts

Dependencies added: transformers

Dependencies removed: mtl

Dependency ranges changed: haskell-src-exts

Files

ChangeLog view
@@ -1,3 +1,9 @@+v1.0.4.5:+* Fix using show when I meant prettyprint+* Fix testsuite dependencies+* Replace mtl dep with transformers+* Broaden HSE dep version range+ v1.0.4.4: * Replace custom parser with HSE parser, fixing many bugs * Dependency update for GHC 7.6
Main.hs view
@@ -3,6 +3,7 @@ import Plugin.Pl.Common import Plugin.Pl.Optimize import Plugin.Pl.Parser+import Plugin.Pl.PrettyPrinter import Plugin.Pl.Transform  import System.Environment (getArgs)@@ -39,9 +40,9 @@     if verbose        then do putStrLn "Transformed to pointfree style:"                let d' = mapTopLevel transform d-               print $ d'+               putStrLn $ prettyTopLevel d'                putStrLn "Optimized expression:"-               mapM_ print $ mapTopLevel' optimize d'-       else print $ last $ mapTopLevel' optimize $ mapTopLevel transform d+               mapM_ (putStrLn . prettyTopLevel) $ mapTopLevel' optimize d'+       else putStrLn . prettyTopLevel . last . mapTopLevel' optimize $ mapTopLevel transform d   Left err -> putStrLn err 
Plugin/Pl/Transform.hs view
@@ -9,7 +9,7 @@ import qualified Data.Map as M  import Data.Graph (stronglyConnComp, flattenSCC, flattenSCCs)-import Control.Monad.State+import Control.Monad.Trans.State  {- nub :: Ord a => [a] -> [a]
pointfree.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.8  Name:     pointfree-Version:  1.0.4.4+Version:  1.0.4.5 Category: Tool Synopsis: Tool for refactoring expressions into pointfree form @@ -14,9 +14,11 @@ License:      OtherLicense License-file: LICENSE -Build-type:         Simple Extra-source-files: ChangeLog README test/Test.hs +Build-type:  Simple+Tested-with: GHC == 6.12.3, GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.2+ Source-repository head   type:     git   location: git://github.com/benmachine/pointfree.git@@ -33,8 +35,8 @@                  array >= 0.3 && < 0.5,                  containers >= 0.3 && < 0.6,                  -- probably the below could be more generous-                 haskell-src-exts == 1.13.*,-                 mtl >= 2 && < 2.2+                 haskell-src-exts >= 1.11 && < 1.14,+                 transformers < 0.4   Other-modules: Plugin.Pl.Common                  Plugin.Pl.Parser                  Plugin.Pl.PrettyPrinter@@ -49,9 +51,13 @@   Other-modules:    Build-depends:+    array >= 0.3 && < 0.5,     base < 5,+    containers >= 0.3 && < 0.6,+    haskell-src-exts >= 1.11 && < 1.14,     HUnit >= 1.1 && < 1.3,-    QuickCheck >= 2.1 && < 2.6+    QuickCheck >= 2.1 && < 2.6,+    transformers < 0.4    Extensions:     ExistentialQuantification
test/Test.hs view
@@ -1,4 +1,4 @@-module Main where+module Main (main) where  import Test.HUnit import Test.QuickCheck@@ -57,19 +57,6 @@ propMonotonic2 :: Expr -> Expr -> Expr -> Bool propMonotonic2 e e1 e2 = App e1 e `compare` App e2 e == e1 `compare` e2 -sizeTest :: IO ()-sizeTest = quickCheck $ \e -> collect (sizeExpr e) (propRoundTrip e)--quick :: Args-quick = stdArgs-  { maxSuccess = 100-  , maxDiscardRatio = 10-  , maxSize    = 40-  }--myTest :: IO ()-myTest = quickCheckWith quick propRoundTrip- qcTests :: IO () qcTests = do   quickCheck propRoundTrip@@ -88,16 +75,20 @@     mapM_ print $ mapTopLevel' optimize d'   Left err -> putStrLn $ err -pf' :: String -> IO ()-pf' = putStrLn . (id ||| prettyTopLevel) . parsePF- unitTest :: String -> [String] -> Test unitTest inp out = TestCase $ do   d <- case parsePF inp of     Right x -> return x     Left err -> fail $ "Parse error on input " ++ inp ++ ": " ++ err-  let d' = mapTopLevel (last . optimize . transform) d-  foldr1 mplus [assertEqual (inp++" failed.") o (prettyTopLevel d') | o <- out]+  let res = prettyTopLevel (mapTopLevel (last . optimize . transform) d)+  case out of+    [] -> error "Test case expected result missing!"+    [x] -> assertEqual (inp ++ " failed.") x res+    _ -> assertBool+      (concat [inp, " failed.",+        "\nexpected one of:\n", show out,+        "\n        but got:\n", show res])+      (res `elem` out)  unitTests :: Test unitTests = TestList [