glambda-1.0: A simply typed lambda calculus interpreter, written with GADTs

Copyright(C) 2015 Richard Eisenberg
LicenseBSD-style (see LICENSE)
MaintainerRichard Eisenberg (eir@cis.upenn.edu)
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Language.Glambda.Util

Description

Utility exports (and re-exports) for glambda. This module is meant to be internal -- do not import it if you are not part of the glambda package!

Synopsis

Documentation

render :: Doc -> String Source

Convert a Doc to a String

toSimpleDoc :: Doc -> SimpleDoc Source

Convert a Doc to a SimpleDoc for further rendering

maybeParens :: Bool -> Doc -> Doc Source

Enclose a Doc in parens if the flag is True

($$) :: Doc -> Doc -> Doc Source

Synonym for <$>

type Prec = Rational Source

More perspicuous synonym for operator precedence

topPrec :: Prec Source

Precedence for top-level printing

stripWhitespace :: String -> String Source

(Inefficiently) strips whitespace from a string

nthDefault :: a -> Int -> [a] -> a Source

Pluck out the nth item from a list, or use a default if the list is too short

data a :~: b :: k -> k -> * where infix 4

Propositional equality. If a :~: b is inhabited by some terminating value, then the type a is the same as the type b. To use this equality in practice, pattern-match on the a :~: b to get out the Refl constructor; in the body of the pattern-match, the compiler knows that a ~ b.

Since: 4.7.0.0

Constructors

Refl :: (:~:) k a1 a1 

Instances

TestEquality k ((:~:) k a) 
(~) k a b => Bounded ((:~:) k a b) 
(~) k a b => Enum ((:~:) k a b) 
Eq ((:~:) k a b) 
Ord ((:~:) k a b) 
(~) k a b => Read ((:~:) k a b) 
Show ((:~:) k a b) 

ignore :: Functor f => f a -> f () Source

Like void