hindent 4.4.0 → 4.4.1
raw patch · 13 files changed
+192/−9 lines, 13 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- README.md +2/−1
- elisp/hindent.el +8/−1
- hindent.cabal +8/−2
- src/HIndent/Pretty.hs +19/−3
- src/HIndent/Styles/Gibiansky.hs +6/−2
- test/gibiansky/expected/26.exp +1/−0
- test/gibiansky/expected/27.exp +27/−0
- test/gibiansky/expected/28.exp +17/−0
- test/gibiansky/expected/29.exp +29/−0
- test/gibiansky/tests/26.test +1/−0
- test/gibiansky/tests/27.test +28/−0
- test/gibiansky/tests/28.test +17/−0
- test/gibiansky/tests/29.test +29/−0
README.md view
@@ -1,4 +1,5 @@-# hindent [](https://hackage.haskell.org/package/hindent)++# hindent [](https://hackage.haskell.org/package/hindent) [](https://travis-ci.org/chrisdone/hindent) Extensible Haskell pretty printer. Both a library and an executable. Currently a work in progress (see
elisp/hindent.el view
@@ -30,6 +30,13 @@ :type 'string :safe #'stringp) +(defcustom hindent-process-path+ "hindent"+ "Location where the hindent executable is located."+ :group 'haskell+ :type 'string+ :safe #'stringp)+ ;;;###autoload (defun hindent/reformat-decl () "Re-format the current declaration by parsing and pretty@@ -47,7 +54,7 @@ (let ((ret (apply #'call-process-region (append (list (car start-end) (cdr start-end)- "hindent"+ hindent-process-path nil ; delete temp ; output nil
hindent.cabal view
@@ -1,5 +1,5 @@ name: hindent-version: 4.4.0+version: 4.4.1 synopsis: Extensible Haskell pretty printer description: Extensible Haskell pretty printer. Both a library and an executable. .@@ -13,6 +13,8 @@ category: Development build-type: Simple cabal-version: >=1.8+homepage: http://www.github.com/chrisdone/hindent+bug-reports: https://github.com/chrisdone/hindent/issues data-files: elisp/hindent.el vim/hindent.vim extra-source-files: README.md test/chris-done/expected/*.exp@@ -24,6 +26,10 @@ test/johan-tibell/expected/*.exp test/johan-tibell/tests/*.test +source-repository head+ type: git+ location: https://github.com/chrisdone/hindent+ library hs-source-dirs: src/ ghc-options: -Wall -O2@@ -35,7 +41,7 @@ HIndent.Styles.ChrisDone HIndent.Styles.JohanTibell HIndent.Styles.Gibiansky- build-depends: base >= 4 && <5+ build-depends: base >= 4.7 && <5 , data-default , haskell-src-exts == 1.16.* , monad-loops
src/HIndent/Pretty.hs view
@@ -544,7 +544,7 @@ TyInfix _ a op b -> depend (do pretty a space)- (depend (do pretty op+ (depend (do prettyInfixOp op space) (pretty b)) TyKind _ ty k ->@@ -720,6 +720,7 @@ do write "| " pretty p) alts))+exp (Lit _ lit) = prettyInternal lit exp x@XTag{} = pretty' x exp x@XETag{} = pretty' x exp x@XPcdata{} = pretty' x@@ -728,7 +729,6 @@ exp x@Var{} = pretty' x exp x@IPVar{} = pretty' x exp x@Con{} = pretty' x-exp x@Lit{} = pretty' x exp x@CorePragma{} = pretty' x exp x@SCCPragma{} = pretty' x exp x@GenPragma{} = pretty' x@@ -1238,7 +1238,23 @@ prettyInternal = pretty' instance Pretty Literal where- prettyInternal = pretty'+ prettyInternal (String _ _ rep) = do+ write "\""+ string rep+ write "\""+ prettyInternal (Char _ _ rep) = do+ write "'"+ string rep+ write "'"+ prettyInternal (PrimString _ _ rep) = do+ write "\""+ string rep+ write "\"#"+ prettyInternal (PrimChar _ _ rep) = do+ write "'"+ string rep+ write "'#"+ prettyInternal x = pretty' x instance Pretty Name where prettyInternal = pretty'
src/HIndent/Styles/Gibiansky.hs view
@@ -231,7 +231,7 @@ letExpr (Let _ binds result) = do cols <- depend (write "let ") $ do col <- getColumn- pretty binds+ writeWhereBinds binds return $ col - 4 column cols $ do newline@@ -468,9 +468,11 @@ case alts of [] -> return () first:rest -> do+ printComments Before first prettyPr first forM_ (zip alts rest) $ \(prev, cur) -> do replicateM_ (max 1 $ lineDelta cur prev) newline+ printComments Before cur prettyPr cur where@@ -611,7 +613,9 @@ write " " return (name, pat, rhs, mbinds) - pretty name+ case name of+ Symbol _ name' -> string name'+ name' -> pretty name' write " " funBody pat rhs mbinds decls decl = prettyNoExt decl
+ test/gibiansky/expected/26.exp view
@@ -0,0 +1,1 @@+a +++ b = a * a + b
+ test/gibiansky/expected/27.exp view
@@ -0,0 +1,27 @@+case x of+ -- First+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+ x -> y+>+ -- Second+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+ x -> y
+ test/gibiansky/expected/28.exp view
@@ -0,0 +1,17 @@+"ß"++-- Test it in pattern context too+"ß" = 3++'ß'++'ß' = 3++"ß"#++-- Test it in pattern context too+"ß"# = 3++'ß'#++'ß'# = 3
+ test/gibiansky/expected/29.exp view
@@ -0,0 +1,29 @@+a =+ let x = y+ z = 10+ in z++a =+ let x = y+>+ z = 10+ in z++a =+ let x = y+>+ z = 10+>+>+ z' = 10+ in z++a =+ let x = y+>+ -- Comment+ z = 10+>+ -- Comment some more+ z' = 10+ in z
+ test/gibiansky/tests/26.test view
@@ -0,0 +1,1 @@+a +++ b = a * a + b
+ test/gibiansky/tests/27.test view
@@ -0,0 +1,28 @@+case x of+ -- First+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+ x -> y+>+ -- Second+ x -> y++case x of+ -- First+ x -> y+>+ -- Second+>+ x -> y
+ test/gibiansky/tests/28.test view
@@ -0,0 +1,17 @@+"ß"++-- Test it in pattern context too+"ß" = 3++'ß'++'ß' = 3++"ß"#++-- Test it in pattern context too+"ß"# = 3++'ß'#++'ß'# = 3
+ test/gibiansky/tests/29.test view
@@ -0,0 +1,29 @@+a =+ let x = y+ z = 10+ in z++a =+ let x = y+>+ z = 10+ in z++a =+ let x = y+>+ z = 10+>+>+ z' = 10+ in z++a =+ let x = y+>+ -- Comment+ z = 10+>+ -- Comment some more+ z' = 10+ in z