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.Monad

Contents

Description

The Glam monad, allowing for pretty-printed output to the user, failing with an error message, and tracking global variables.

Synopsis

The Glam monad

data Glam a Source

A monad giving Haskeline-like interaction, access to Globals, and the ability to abort with mzero.

runGlam :: Glam () -> InputT IO () Source

Run a Glam computation

prompt :: String -> Glam (Maybe String) Source

Prompt the user for input, returning a string if one is entered. Like getInputLine.

quit :: Glam a Source

Abort the Glam monad

The GlamE monad

data GlamE a Source

Like the Glam monad, but also supporting error messages via Docs

runGlamE :: GlamE a -> Glam (Either Doc a) Source

Run a GlamE computation

issueError :: Doc -> GlamE a Source

Abort the computation with an error

General functions over both glamorous monads

class GlamM m where Source

Class for the two glamorous monads

Methods

printDoc :: Doc -> m () Source

Print a Doc without a newline at the end

printLine :: Doc -> m () Source

Print a Doc with a newline

Instances