Simple printing with Text. This is a prototype, not production code.
base >= 4.6 && <4.10,
text >= 1.2 && <1.3,
text-format >= 0.3 && <0.4
Replaces the Prelude function show
:
show :: Show a => a -> String
... with a new one that uses Text.
show :: Show a => a -> Text
A Text-based Show replacement can be derived with GHC's new
-XDeriveAnyClass
.
{-# LANGUAGE DeriveAnyClass #-}
data Animal
= Dog
| Cat
deriving (Generic, Print.Show)
GHCI's default printing mechanism can be overloaded by adding the following to
your .ghci
file. Anything typed at the console will then use the modern
print
function instead of the Prelude.
import Print
:set -interactive-print=Print.print
Stack (Recommended)
$ stack build
$ stack repl print:exe:Example
Cabal
$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal build
$ cabal repl exe:Example