goatee-0.3.1.2: A monadic take on a 2,500-year-old board game - library.

Safe HaskellSafe
LanguageHaskell98

Game.Goatee.Lib.Renderer

Description

Common definitions for a renderer that supports failure.

Synopsis

Documentation

type Render = WriterT String (Except String) Source #

A monad for accumulating string output with the possibility of failure.

runRender :: Render a -> Either String String Source #

Returns either the rendered result on the right, or a message describing a failure on the left.

rendererOf :: Show a => String -> (a -> Render ()) -> a -> Render () Source #

Wraps a renderer in an exception handler that, when the renderer or something it calls fails, will add context about this renderer's invocation to the failure message.