pointfree 1.1 → 1.1.1.1
raw patch · 7 files changed
+52/−42 lines, 7 filesdep ~HUnitdep ~haskell-src-extsdep ~transformers
Dependency ranges changed: HUnit, haskell-src-exts, transformers
Files
- ChangeLog +9/−1
- Plugin/Pl/Parser.hs +3/−3
- Plugin/Pl/PrettyPrinter.hs +11/−1
- Plugin/Pl/Rules.hs +1/−0
- Plugin/Pl/Transform.hs +1/−0
- pointfree.cabal +24/−35
- test/Test.hs +3/−2
ChangeLog view
@@ -1,3 +1,10 @@+v1.1.1.1:+* Dependency update for HSE 1.17, transformers 0.5+* Trim tested-with, I no longer have a working copy of old GHCs++v1.1.1:+* Fix some bugs in qualified operator handling+ v1.1: * Drop support for GHC 7.0 and 7.2 (actually already lost with HSE 1.16) * Add support for GHC 7.10.1@@ -7,7 +14,8 @@ * Dependency update for QuickCheck 2.9 v1.0.4.8:-* Dependency update for HSE 1.16 and transformers 0.5+* Dependency update for HSE 1.16+* Fixing support for transformers 0.4 v1.0.4.7: * Dependency update for HSE 1.15 and transformers 0.4
Plugin/Pl/Parser.hs view
@@ -12,7 +12,7 @@ nameString (HSE.Symbol s) = (Inf, s) qnameString :: HSE.QName -> (Fixity, String)-qnameString (HSE.Qual m n) = fmap (HSE.prettyPrint m ++) (nameString n)+qnameString (HSE.Qual m n) = fmap ((HSE.prettyPrint m ++ ".") ++) (nameString n) qnameString (HSE.UnQual n) = nameString n qnameString (HSE.Special sc) = case sc of HSE.UnitCon -> (Pref, "()")@@ -68,9 +68,9 @@ hseToDecl :: HSE.Decl -> Decl hseToDecl dec = case dec of- HSE.PatBind _ (HSE.PVar n) (HSE.UnGuardedRhs e) (HSE.BDecls []) ->+ HSE.PatBind _ (HSE.PVar n) (HSE.UnGuardedRhs e) Nothing -> Define (snd (nameString n)) (hseToExpr e)- HSE.FunBind [HSE.Match _ n ps Nothing (HSE.UnGuardedRhs e) (HSE.BDecls [])] ->+ HSE.FunBind [HSE.Match _ n ps Nothing (HSE.UnGuardedRhs e) Nothing] -> Define (snd (nameString n)) (foldr (\p x -> Lambda (hseToPattern p) x) (hseToExpr e) ps) _ -> todo dec
Plugin/Pl/PrettyPrinter.hs view
@@ -127,7 +127,17 @@ prettyPrecPattern 6 p1 . (':':) . prettyPrecPattern 5 p2 isOperator :: String -> Bool-isOperator s = s /= "()" && all (\c -> isSymbol c || isPunctuation c) s+isOperator s =+ case break (== '.') s of+ (_, "") -> isUnqualOp s+ (before, _dot : rest)+ | isUnqualOp before -> isUnqualOp rest+ | isModule before -> isOperator rest+ | otherwise -> False+ where+ isModule "" = False+ isModule (c : cs) = isUpper c && all (\c -> isAlphaNum c || c `elem` ['\'', '_']) cs+ isUnqualOp s = s /= "()" && all (\c -> isSymbol c || isPunctuation c) s getInfName :: String -> String getInfName str = if isOperator str then str else "`"++str++"`"
Plugin/Pl/Rules.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} -- -- | This marvellous module contributed by Thomas J\344ger
Plugin/Pl/Transform.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE PatternGuards #-} module Plugin.Pl.Transform ( transform, ) where
pointfree.cabal view
@@ -1,7 +1,7 @@ Cabal-Version: >= 1.8 Name: pointfree-Version: 1.1+Version: 1.1.1.1 Category: Tool Synopsis: Tool for refactoring expressions into pointfree form @@ -17,40 +17,36 @@ Extra-source-files: ChangeLog README test/Test.hs Build-type: Simple-Tested-with: GHC == 7.4.2, GHC == 7.6.2, GHC == 7.8.2, GHC == 7.10.1+Tested-with: GHC == 7.10.2 Source-repository head type: git location: git://github.com/benmachine/pointfree.git -library- Exposed-modules: Pointfree- Build-depends: base >= 4.5 && < 4.9,- array >= 0.3 && < 0.6,- containers >= 0.4 && < 0.6,- haskell-src-exts == 1.16.*,- transformers < 0.5- Other-modules: Plugin.Pl.Common- Plugin.Pl.Parser- Plugin.Pl.PrettyPrinter- Plugin.Pl.Optimize- Plugin.Pl.Rules- Plugin.Pl.Transform- GHC-options: -Wall+Library+ Exposed-modules: Pointfree + Build-depends: base >= 4.5 && < 4.9,+ array >= 0.3 && < 0.6,+ containers >= 0.4 && < 0.6,+ haskell-src-exts == 1.17.*,+ transformers < 0.6+ Other-modules: Plugin.Pl.Common+ Plugin.Pl.Parser+ Plugin.Pl.PrettyPrinter+ Plugin.Pl.Optimize+ Plugin.Pl.Rules+ Plugin.Pl.Transform+ GHC-options: -W+ Executable pointfree Main-is: Main.hs- GHC-options: -Wall- Extensions: ExistentialQuantification,- FlexibleInstances,- ImplicitParams,- PatternGuards,- ScopedTypeVariables+ GHC-options: -W Build-depends: base >= 4.3 && < 4.9, array >= 0.3 && < 0.6, containers >= 0.4 && < 0.6,- haskell-src-exts == 1.16.*,- transformers < 0.5+ haskell-src-exts == 1.17.*,+ transformers < 0.6 Other-modules: Plugin.Pl.Common Plugin.Pl.Parser Plugin.Pl.PrettyPrinter@@ -68,17 +64,10 @@ array >= 0.3 && < 0.6, base < 5, containers >= 0.3 && < 0.6,- haskell-src-exts == 1.16.*,- HUnit >= 1.1 && < 1.3,+ haskell-src-exts == 1.17.*,+ HUnit >= 1.1 && < 1.4, QuickCheck >= 2.1 && < 2.9,- transformers < 0.5-- Extensions:- ExistentialQuantification- FlexibleInstances- ImplicitParams- PatternGuards- ScopedTypeVariables+ transformers < 0.6 - GHC-Options: -Wall+ GHC-Options: -W Hs-source-dirs: . test
test/Test.hs view
@@ -9,7 +9,6 @@ import Plugin.Pl.PrettyPrinter import Plugin.Pl.Optimize -import Data.List ((\\)) import Data.Char (isSpace) import System.IO (hSetBuffering, stdout, BufferMode(NoBuffering))@@ -185,7 +184,9 @@ unitTest "(concat .) . map" ["(=<<)"], unitTest "let f ((a,b),(c,d)) = a + b + c + d in f ((1,2),(3,4))" ["10"], unitTest "let x = const 3 y; y = const 4 x in x + y" ["7"], -- yay!- unitTest "(\\n -> (return 0) ± (return $ sqrt n))" ["(return 0 ±) . return . sqrt"]+ unitTest "(\\n -> (return 0) ± (return $ sqrt n))" ["(return 0 ±) . return . sqrt"],+ unitTest "\\b -> (\\c -> ((Control.Monad.>>=) c) (\\g -> Control.Applicative.pure (b g)))"+ ["flip (Control.Monad.>>=) . (Control.Applicative.pure .)"] ] main :: IO ()