termlib-0.9: Term Rewriting Library

Safe HaskellSafe-Infered

Termlib.Utils

Contents

Synopsis

Parsing and Printing

columns :: Int -> [[Doc]] -> Doc

columns' :: [(Int, [Doc])] -> Doc

data PPTree a

Constructors

PPTree 

Fields

pptRoots :: [a]
 
pptSuc :: a -> [a]
 

printTree :: Int -> ([a] -> a -> Doc) -> ([a] -> a -> Doc) -> PPTree a -> Doc

class Parsable a where

Methods

parse :: Stream s m Char => ParsecT s u m a

parseFromString :: Parsable a => String -> Either ParseError a

Memoisation

type MemoAction k a = State (Map k a)

memo :: Ord k => k -> MemoAction k a a -> MemoAction k a a

runMemoAction :: Ord k => MemoAction k a b -> b

liftMemo :: Ord k => (k -> a) -> k -> MemoAction k a a

List Utility Functions

listProduct :: [[a]] -> [[a]]

snub :: Ord a => [a] -> [a]

Monad Utilities

newtype MaybeT m a

Constructors

MaybeT 

Fields

runMaybeT :: m (Maybe a)
 

Instances

Monad m => Monad (MaybeT m) 

eitherM :: Monad m => (a -> m c) -> (b -> m c) -> m (Either a b) -> m c

ifM :: Monad m => m Bool -> m a -> m a -> m a

Parsec Utility Functions

($++$) :: Doc -> Doc -> Doc

enumerated :: [Doc] -> [Doc] -> Doc

block :: String -> Doc -> Doc

Misc

class Enumerateable a where

Methods

enum :: a -> Int

invEnum :: Int -> a