Simple printing with Text
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
.travis.yml
Example.hs
LICENSE
README.md
Setup.hs
print.cabal
stack.yaml

README.md

Print

Build Status

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

Functions

Replaces the Prelude function show:

show :: Show a => a -> String

... with a new one that uses Text.

show :: Show a => a -> Text

Instances

A Text-based Show replacement can be derived with GHC's new -XDeriveAnyClass.

{-# LANGUAGE DeriveAnyClass #-}

data Animal 
  = Dog
  | Cat
  deriving (Generic, Print.Show)

GHCi

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

Building

Stack (Recommended)

$ stack build
$ stack repl print:exe:Example

Cabal

$ cabal sandbox init
$ cabal install --only-dependencies
$ cabal build
$ cabal repl exe:Example