packages feed

pretty-simple 4.1.2.0 → 4.1.3.0

raw patch · 7 files changed

+35/−73 lines, 7 filesdep −Globdep −QuickCheckdep −doctestdep ~basesetup-changed

Dependencies removed: Glob, QuickCheck, doctest, template-haskell

Dependency ranges changed: base

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## 4.1.3.0++*   Remove custom setup. This makes cross-compiling `pretty-simple` a lot more+    straightforward. No functionality has been lost from the library, since the+    custom setup was only used for generating tests.+    [#107](https://github.com/cdepillabout/pretty-simple/pull/107)  ## 4.1.2.0 
README.md view
@@ -39,9 +39,6 @@  ![example screenshot](https://raw.githubusercontent.com/cdepillabout/pretty-simple/master/img/pretty-simple-example-screenshot.png) -There's a [web app](https://cdepillabout.github.io/pretty-simple) compiled with-GHCJS where you can play around with `pretty-simple` running in your browser.- ## Usage  `pretty-simple` can be easily used from `ghci` when debugging.@@ -77,6 +74,14 @@     ) ``` +If for whatever reason you're not able to incur a dependency on the `pretty-simple` library, you can simulate its behaviour by using `process` to call out to the command line executable (see below for installation):+```hs+pPrint :: Show a => a -> IO ()+pPrint = putStrLn <=< readProcess "pretty-simple" [] . show+```++There's also a [web app](https://cdepillabout.github.io/pretty-simple), compiled with GHCJS, where you can play around with `pretty-simple` in your browser.+ ## Features  - Easy-to-read@@ -209,6 +214,14 @@ [issue](https://github.com/cdepillabout/pretty-simple/issues) or [PR](https://github.com/cdepillabout/pretty-simple/pulls) for any bugs/problems/suggestions/improvements.++### Testing++To run the test suite locally, one must install the executables `doctest` and+`cabal-doctest`, e.g. with+`cabal install --ignore-project doctest --flag cabal-doctest`.++Then run the command `cabal doctest`.  ## Maintainers 
− Setup.hs
@@ -1,33 +0,0 @@-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "pretty-simple-doctest"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-#warning You are configuring this package without cabal-doctest installed. \-         The doctests test-suite will not work as a result. \-         To fix this, install cabal-doctest before configuring.-#endif--import Distribution.Simple--main :: IO ()-main = defaultMain--#endif
pretty-simple.cabal view
@@ -1,5 +1,5 @@ name:                pretty-simple-version:             4.1.2.0+version:             4.1.3.0 synopsis:            pretty printer for data types with a 'Show' instance. description:         Please see <https://github.com/cdepillabout/pretty-simple#readme README.md>. homepage:            https://github.com/cdepillabout/pretty-simple@@ -9,17 +9,12 @@ maintainer:          cdep.illabout@gmail.com copyright:           2017-2019 Dennis Gosnell category:            Text-build-type:          Custom+build-type:          Simple extra-source-files:  CHANGELOG.md                    , README.md                    , img/pretty-simple-example-screenshot.png cabal-version:       >=1.10 -custom-setup-  setup-depends:     base-                   , Cabal >= 1.24-                   , cabal-doctest >=1.0.2- flag buildexe   description: Build an small command line program that pretty-print anything from stdin.   default:     True@@ -95,18 +90,6 @@     buildable:       True   else     buildable:       False--test-suite pretty-simple-doctest-  type:                exitcode-stdio-1.0-  main-is:             DocTest.hs-  hs-source-dirs:      test-  build-depends:       base-                     , doctest >= 0.13-                     , Glob-                     , QuickCheck-                     , template-haskell-  default-language:    Haskell2010-  ghc-options:         -Wall -threaded -rtsopts -with-rtsopts=-N  benchmark pretty-simple-bench   type:                exitcode-stdio-1.0
src/Text/Pretty/Simple.hs view
@@ -658,6 +658,11 @@ --         ] --     } --+-- __Char__+--+-- >>> pPrint 'λ'+-- 'λ'+-- -- __Compactness options__ -- -- >>> pPrintStringOpt CheckColorTty defaultOutputOptionsDarkBg {outputOptionsCompact = True} "AST [] [Def ((3,1),(5,30)) (Id \"fact'\" \"fact'\") [] (Forall ((3,9),(3,26)) [((Id \"n\" \"n_0\"),KPromote (TyCon (Id \"Nat\" \"Nat\")))])]"
src/Text/Pretty/Simple/Internal/Printer.hs view
@@ -233,15 +233,15 @@   Brackets xss -> list "[" "]" xss   Braces xss -> list "{" "}" xss   Parens xss -> list "(" ")" xss-  StringLit s -> join enclose (annotate Quote "\"") $ annotate String $ pretty $-    case outputOptionsStringStyle opts of-      Literal -> s-      EscapeNonPrintable -> escapeNonPrintable $ readStr s-      DoNotEscapeNonPrintable -> readStr s-  CharLit s -> join enclose (annotate Quote "'") $ annotate String $ pretty s+  StringLit s -> join enclose (annotate Quote "\"") $ annotate String $ pretty $ escapeString s+  CharLit s -> join enclose (annotate Quote "'") $ annotate String $ pretty $ escapeString s   Other s -> pretty s   NumberLit n -> annotate Num $ pretty n   where+    escapeString s = case outputOptionsStringStyle opts of+      Literal -> s+      EscapeNonPrintable -> escapeNonPrintable $ readStr s+      DoNotEscapeNonPrintable -> readStr s     readStr :: String -> String     readStr s = fromMaybe s . readMaybe $ '"' : s ++ "\""     list :: Doc Annotation -> Doc Annotation -> CommaSeparated [Expr]
− test/DocTest.hs
@@ -1,12 +0,0 @@-module Main where--import Build_doctests (flags, pkgs, module_sources)--- import Data.Foldable (traverse_)-import Test.DocTest (doctest)--main :: IO ()-main = do-  -- traverse_ putStrLn args-  doctest args-  where-    args = flags ++ pkgs ++ module_sources