cco-0.0.2: A library accompanying the course on Compiler constructionContentsIndex
CCO.Feedback
Portabilityportable
Stabilityprovisional
Maintainerstefan@cs.uu.nl
Contents
Messages
The Feedback monad
Description
A monad for keeping track of log, warning, and error messages.
Synopsis
data Message
= Log Int Doc
| Warning Int Doc
| Error Doc
isError :: Message -> Bool
fromMessage :: Message -> Doc
data Feedback a
trace :: Int -> String -> Feedback ()
trace_ :: String -> Feedback ()
warn :: Int -> String -> Feedback ()
warn_ :: String -> Feedback ()
message :: Message -> Feedback ()
messages :: [Message] -> Feedback ()
wError :: Feedback a -> Feedback a
runFeedback :: Feedback a -> Int -> Int -> Handle -> IO (Maybe a)
Messages
data Message
Type of messages. Each Message holds a pretty-printable document in which the text for the message is stored.
Constructors
Log Int DocA log message at a specified verbosity level, the default level being 1.
Warning Int DocA warning message at a specified severity level, the default level being 1.
Error DocAn error message.
isError :: Message -> Bool
Indicates whether a Message is an Error message.
fromMessage :: Message -> Doc
Retrieves the Doc stored in a Message.
The Feedback monad
data Feedback a
The Feedback monad. Keeps track of Messages, failing if an Error message is encountered.
show/hide Instances
Monad Feedback
Functor Feedback
trace :: Int -> String -> Feedback ()
Issues a Log message at a specified verbosity level containing a specified text.
trace_ :: String -> Feedback ()
Issues a Log message at the default verbosity level 1 containing a specified text.
warn :: Int -> String -> Feedback ()
Issues a Warning message at a specified severity level containing a specified text.
warn_ :: String -> Feedback ()
Issues a Warning message at the default severity level 1 containing a specified text.
message :: Message -> Feedback ()
Issues a Message. Fails if an Error message is issued.
messages :: [Message] -> Feedback ()
Issues a list of Messages. Fails if the list contains an Error message.
wError :: Feedback a -> Feedback a
Turns all Warning messages into Error messages.
runFeedback :: Feedback a -> Int -> Int -> Handle -> IO (Maybe a)
Runs a Feedback computation at a specified verbosity and severity level, pretty printing messages onto a specified Handle.
Produced by Haddock version 2.0.0.0