pretty-ghci: Functionality for beautifying GHCi

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Provides a library and an executable for parsing and pretty-printing the output of derived Show instances as well as Haddock docstrings. The idea is to provide functionality that can be easily plugged into GHCi's -interactive-print option, making for a better REPL experience.


[Skip to Readme]

Properties

Versions 0.1.0.0, 0.2.0.0, 0.2.0.0
Change log CHANGELOG.md
Dependencies array (>=0.5 && <0.6), base (>=4.9 && <4.13), haddock-library (>=1.7 && <1.8), pretty-ghci, prettyprinter (>=1.2 && <1.3), prettyprinter-ansi-terminal (>=1.1 && <1.2), text (>=1.2 && <1.3), Win32 (>=2.6.2) [details]
License BSD-3-Clause
Copyright (c) Alec Theriault
Author Alec Theriault
Maintainer alec.theriault@gmail.com
Category Text
Source repo head: git clone https://github.com/harpocrates/pretty-ghci.git
Uploaded by harpocrates at 2019-04-16T14:52:32Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for pretty-ghci-0.2.0.0

[back to package description]

pretty-ghci Travis Status Appveyor Status Hackage

This library will make your GHCi experience colourful in 3 steps:

  1. Install the executable globally with cabal v2-install pretty-ghci

  2. Modify your ~/.ghc/ghci.conf

    :set prompt      "λ> "
    :set prompt-cont "|> "
    
    -- Typing `:pretty` will turn on the pretty-printing
    :set -package process
    :{
    :def pretty \_ -> pure $ unlines $
      [ ":{"
      , "let pprint x = System.Process.withCreateProcess cp' $ \\(Just i) _ _ ph -> do"
      , "        System.IO.hPutStrLn i (show x)"
      , "        System.IO.hClose i"
      , "        _ <- System.Process.waitForProcess ph"
      , "        pure ()"
      , "      where cp = System.Process.proc \"pp-ghci\" [\"--value\", \"--smarter-layout\"]"
      , "            cp' = cp{ System.Process.std_out = System.Process.Inherit"
      , "                    , System.Process.std_err = System.Process.Inherit"
      , "                    , System.Process.std_in  = System.Process.CreatePipe }"
      , ":}"
      , ":set -interactive-print pprint"
      ]
    :}
    
    -- Typing `:no-pretty` will turn off the pretty-printing
    :def no-pretty \_ -> pure (":set -interactive-print System.IO.print")
    
    -- Make things pretty by default!
    :pretty
    
  3. Enjoy!

Advantages over existing alternatives