ipprint 0.3 → 0.4
raw patch · 2 files changed
+19/−5 lines, 2 filesdep +Extradep ~basePVP ok
version bump matches the API change (PVP)
Dependencies added: Extra
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- IPPrint.hs +13/−3
- ipprint.cabal +6/−2
IPPrint.hs view
@@ -1,13 +1,20 @@ module IPPrint(pshow, pprint) where +import Extra.Terminal (getWidth) import Language.Haskell.Parser import Language.Haskell.Pretty import Text.Read +defaultLineWidth :: Int+defaultLineWidth = 80+ pshow :: Show a => a -> String-pshow v =+pshow = pshowWidth defaultLineWidth++pshowWidth :: Show a => Int -> a -> String+pshowWidth width v = case parseModule ("value = "++s) of- ParseOk m -> tidy $ prettyPrint m+ ParseOk m -> tidy $ prettyPrintStyleMode (Style PageMode width 1.1) defaultMode m ParseFailed _ _ -> s where s = show v@@ -18,7 +25,10 @@ pprint :: Show a => a -> IO ()-pprint = putStrLn . pshow+pprint v = do+ mw <- getWidth+ let width = maybe defaultLineWidth id mw+ putStrLn $ pshowWidth width v skipBoring :: ReadPrec () skipBoring =
ipprint.cabal view
@@ -1,6 +1,6 @@ Name: ipprint Category: Text-Version: 0.3+Version: 0.4 License: BSD3 License-file: LICENSE Author: Gleb Alexeyev@@ -18,6 +18,10 @@ > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], - > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]] + > [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]]+ .+ Terminal width support added by Jean-Marie Gaillourdet. Exposed-modules: IPPrint+Build-Type: Simple+Build-Depends: base >= 2 && <= 5, Extra >= 1.33 && < 1.34