groom-0.1.2.1/0000755000000000000000000000000013075545332011171 5ustar0000000000000000groom-0.1.2.1/groom.cabal0000644000000000000000000000335313075545332013304 0ustar0000000000000000Name: groom Version: 0.1.2.1 Synopsis: Pretty printing for well-behaved Show instances. Description: Automatically derived Show instances are an easy way to inspect data in your program. However, for large data-structures, the resulting output lacks whitespace, making it unreadable. Groom offers an replacement to `show' called `groom' which attempts to pretty-print the output of `show'. For example: . > let x = parseExp "foobar 1 [1,2]" > in do > putStrLn (show x) > putStrLn (groom x) . results in: . > ParseOk (App (App (Var (UnQual (Ident "foobar"))) (Lit (Int 1))) (List [Lit (Int 1),Lit (Int 2)])) > ParseOk > (App (App (Var (UnQual (Ident "foobar"))) (Lit (Int 1))) > (List [Lit (Int 1), Lit (Int 2)])) . Groom works only on Show instances that output valid Haskell code; if Groom can't understand its input, it will not make any changes. License: BSD3 License-File: LICENSE Author: Edward Z. Yang Maintainer: ezyang@mit.edu Category: Text Build-type: Simple Cabal-version: >=1.8 Library Exposed-modules: Text.Groom Build-depends: haskell-src-exts >= 1.0.0, base >= 3 && < 5 executable groom main-is: Main.hs hs-source-dirs: main build-depends: groom, base groom-0.1.2.1/LICENSE0000644000000000000000000000267713075545332012212 0ustar0000000000000000Copyright (c) Edward Z. Yang 2017 All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the author nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. groom-0.1.2.1/Setup.hs0000644000000000000000000000005613075545332012626 0ustar0000000000000000import Distribution.Simple main = defaultMain groom-0.1.2.1/main/0000755000000000000000000000000013075545332012115 5ustar0000000000000000groom-0.1.2.1/main/Main.hs0000644000000000000000000000010013075545332013324 0ustar0000000000000000import Text.Groom main = getContents >>= putStrLn . groomString groom-0.1.2.1/Text/0000755000000000000000000000000013075545332012115 5ustar0000000000000000groom-0.1.2.1/Text/Groom.hs0000644000000000000000000000045313075545332013536 0ustar0000000000000000module Text.Groom (groom, groomString) where import Language.Haskell.Exts.Parser import Language.Haskell.Exts.Pretty groomString :: String -> String groomString s = case parseExp s of ParseOk x -> prettyPrint x ParseFailed{} -> s groom :: Show a => a -> String groom = groomString . show