-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Disciple Core language common utilities.
--
-- This package re-exports the main external dependencies of the
-- Disciplined Disciple Compiler project.
@package ddc-base
@version 0.2.1.2
-- | Pretty printer utilities.
--
-- This is a re-export of Daan Leijen's pretty printer package
-- (wl-pprint), but with a Pretty class that includes a
-- pprPrec function.
module DDC.Base.Pretty
class Pretty a where ppr = pprPrec 0 pprPrec _ = ppr
ppr :: Pretty a => a -> Doc
pprPrec :: Pretty a => Int -> a -> Doc
-- | Wrap a Doc in parens if the predicate is true.
pprParen :: Bool -> Doc -> Doc
-- | How to pretty print a doc.
data RenderMode
-- | Render the doc with indenting.
RenderPlain :: RenderMode
-- | Render the doc without indenting.
RenderIndent :: RenderMode
-- | Render a doc with the given mode.
render :: RenderMode -> Doc -> String
-- | Convert a Doc to a string without indentation.
renderPlain :: Doc -> String
-- | Convert a Doc to a string with indentation
renderIndent :: Doc -> String
-- | Put a Doc to stdout using the given mode.
putDoc :: RenderMode -> Doc -> IO ()
-- | Put a Doc to stdout using the given mode.
putDocLn :: RenderMode -> Doc -> IO ()
instance Eq RenderMode
instance Show RenderMode
instance (Pretty a, Pretty b) => Pretty (a, b)
instance Pretty a => Pretty (Set a)
instance Pretty a => Pretty [a]
instance Pretty Char
instance Pretty Int
instance Pretty Bool
-- | Lexer utilities.
module DDC.Base.Lexer
-- | A position in the source file.
--
-- If there is no file path then we assume that the input has been read
-- from an interactive session and display ''<interactive>'' when
-- pretty printing.
data SourcePos
SourcePos :: Maybe FilePath -> Int -> Int -> SourcePos
sourcePosFile :: SourcePos -> Maybe FilePath
sourcePosLine :: SourcePos -> Int
sourcePosColumn :: SourcePos -> Int
-- | Wrapper for primitive token type that gives it a source position.
data Token t
Token :: t -> SourcePos -> Token t
tokenTok :: Token t -> t
tokenSourcePos :: Token t -> SourcePos
-- | Take the parsec style source position from a token.
takeParsecSourcePos :: Token k -> SourcePos
instance Eq SourcePos
instance Show SourcePos
instance Eq t => Eq (Token t)
instance Show t => Show (Token t)
instance Pretty SourcePos
-- | Parser utilities.
module DDC.Base.Parser
-- | A generic parser, parameterised over token and return types.
type Parser k a = Eq k => ParsecT [Token k] (ParserState k) Identity a
-- | A parser state that keeps track of the name of the source file.
data ParserState k
ParseState :: (k -> String) -> String -> ParserState k
stateTokenShow :: ParserState k -> k -> String
stateFileName :: ParserState k -> String
-- | Run a generic parser.
runTokenParser :: Eq k => (k -> String) -> String -> Parser k a -> [Token k] -> Either ParseError a
-- | Accept a token if the function returns Just.
pTokMaybe :: (k -> Maybe a) -> Parser k a
-- | Accept a token and return the given value.
pTokAs :: Eq k => k -> t -> Parser k t
-- | Accept the given token.
pTok :: Eq k => k -> Parser k ()
instance Pretty Message
instance Pretty ParseError