-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Parameterized file evaluator
--
-- Please see the README on GitHub at
-- https://github.com/ltext/ltext#README
@package ltext
@version 0.1.5
module LText.Expr
data Expr
Abs :: String -> Expr -> Expr
App :: Expr -> Expr -> Expr
Var :: String -> Expr
Lit :: [Text] -> FilePath -> Bool -> Expr
[litContent] :: Expr -> [Text]
[litSource] :: Expr -> FilePath
[litInError] :: Expr -> Bool
Concat :: Expr -> Expr -> FilePath -> Bool -> Expr
[concatLeft] :: Expr -> Expr
[concatRight] :: Expr -> Expr
[concatSource] :: Expr -> FilePath
[concatInError] :: Expr -> Bool
type MonadPrettyPrint m = (MonadThrow m, MonadIO m)
-- | TODO: pretty print exceptions
ppExpr :: MonadPrettyPrint m => Expr -> m String
data ScopeUse
Fresh :: ScopeUse
Stale :: Expr -> ScopeUse
data ParseState
-- | ..->
InsideLambda :: ParseState
-- | (..)
Scope :: ScopeUse -> ParseState
initParseState :: ParseState
data ParseError
BracketsInsideLambda :: [Lexeme] -> ParseError
LambdaInsideLambda :: [Lexeme] -> ParseError
LambdaInStaleScope :: [Lexeme] -> Expr -> ParseError
ArrowWithoutLambda :: [Lexeme] -> ParseError
ArrowInScope :: [Lexeme] -> ParseError
EmptyExpression :: ParseError
LexerError :: String -> ParseError
handleParseError :: ParseError -> IO a
type MonadParse m = (MonadState ParseState m, MonadThrow m, MonadIO m)
runParse :: Text -> IO Expr
runParserT :: StateT ParseState IO a -> IO a
parseExpr :: MonadParse m => Text -> m Expr
expr :: MonadParse m => [Lexeme] -> m Expr
data Lexeme
Lambda :: Lexeme
Arrow :: Lexeme
Ident :: String -> Lexeme
Bracketed :: [Lexeme] -> Lexeme
[getBracketed] :: Lexeme -> [Lexeme]
-- | Expects to be wrapped in parens
lex :: Parser [Lexeme]
lambda :: Parser Lexeme
arrow :: Parser Lexeme
ident :: Parser Lexeme
bracketed :: Parser Lexeme
instance GHC.Classes.Eq LText.Expr.Expr
instance GHC.Show.Show LText.Expr.Expr
instance GHC.Classes.Eq LText.Expr.ScopeUse
instance GHC.Show.Show LText.Expr.ScopeUse
instance GHC.Classes.Eq LText.Expr.ParseState
instance GHC.Show.Show LText.Expr.ParseState
instance GHC.Classes.Eq LText.Expr.Lexeme
instance GHC.Show.Show LText.Expr.Lexeme
instance GHC.Generics.Generic LText.Expr.ParseError
instance GHC.Classes.Eq LText.Expr.ParseError
instance GHC.Show.Show LText.Expr.ParseError
instance GHC.Exception.Type.Exception LText.Expr.ParseError
instance Test.QuickCheck.Arbitrary.Arbitrary LText.Expr.Expr
module LText.Eval
evaluate :: Expr -> Expr
substitute :: String -> Expr -> Expr -> Expr
freeVars :: Expr -> HashSet String
module LText.Document
-- | A parsed document
data Document
Document :: [Text] -> [DocumentBody] -> Document
-- | Arity of the document - the parameters of the function, where each
-- entry is the name of the term.
[documentArity] :: Document -> [Text]
-- | The function's body
[documentBody] :: Document -> [DocumentBody]
-- | The body of a document is either a block of raw text, or an ltext
-- expression.
data DocumentBody
RawText :: [Text] -> DocumentBody
Expression :: Expr -> DocumentBody
-- | Concatenates adjacent RawText blocks
repackDocument :: [DocumentBody] -> [DocumentBody]
-- | Takes a raw text file and returns the parsed document, and left and
-- right delimiters if it has arity.
parseDocument :: MonadParse m => Text -> m (Document, Maybe (Text, Text))
printDocument :: MonadPrettyPrint m => Maybe (Text, Text) -> Document -> m Text
-- | Given a document, generate an expression (without thinking too hard
-- about it)
fromDocument :: FilePath -> Document -> Expr
data PrintError
-- | Represents a scenario where a Lit is inside a Abs or
-- App.
ConcatExprText :: Expr -> PrintError
NoExplicitDelimiters :: PrintError
data PrintabilityMode
InsideConcat :: PrintabilityMode
InsideExpr :: PrintabilityMode
decorateUnprintable :: Expr -> Expr
isAnyUnprintable :: Expr -> Bool
handlePrintError :: PrintError -> IO a
toDocument :: MonadThrow m => Expr -> m Document
fetchDocument :: FilePath -> IO Expr
rawDocument :: FilePath -> IO Expr
instance GHC.Classes.Eq LText.Document.DocumentBody
instance GHC.Show.Show LText.Document.DocumentBody
instance GHC.Classes.Eq LText.Document.Document
instance GHC.Show.Show LText.Document.Document
instance GHC.Generics.Generic LText.Document.PrintError
instance GHC.Classes.Eq LText.Document.PrintError
instance GHC.Show.Show LText.Document.PrintError
instance GHC.Exception.Type.Exception LText.Document.PrintError
instance Test.QuickCheck.Arbitrary.Arbitrary LText.Document.Document
instance Test.QuickCheck.Arbitrary.Arbitrary LText.Document.DocumentBody
module Application.Types
-- | More technical shared data
data Env
Env :: Expr -> Bool -> HashSet FilePath -> Maybe (String, String) -> Env
[topLevelExpr] :: Env -> Expr
[isTypeQuery] :: Env -> Bool
[rawTerms] :: Env -> HashSet FilePath
[delims] :: Env -> Maybe (String, String)
type MonadApp m = (MonadIO m, MonadReader Env m, MonadThrow m)
type AppM = ReaderT Env IO
runAppM :: Env -> AppM a -> IO a
instance GHC.Show.Show Application.Types.Env
instance GHC.Classes.Eq Application.Types.Env
module LText.Type
-- | We're working in an implicitly quantified prenex-polymorphic type
-- system, so trivial type expressions are also type schemes.
data Type
Text :: Type
TVar :: String -> Type
TArrow :: Type -> Type -> Type
ppType :: Type -> String
data TypeError
CantUnify :: Type -> Type -> TypeError
[expectedType] :: TypeError -> Type
[givenType] :: TypeError -> Type
UnboundVariable :: String -> TypeError
OccursCheckFailure :: String -> Type -> TypeError
handleTypeError :: TypeError -> IO a
data TypeEnv
TypeEnv :: HashSet FilePath -> TypeEnv
[plaintextFiles] :: TypeEnv -> HashSet FilePath
toTypeEnv :: Env -> TypeEnv
emptyTypeEnv :: TypeEnv
type MonadTypecheck m = (MonadState Context m, MonadReader TypeEnv m, MonadThrow m, MonadIO m)
type TypeCheckM = StateT Context (ReaderT TypeEnv IO)
runTypeCheckM :: TypeEnv -> TypeCheckM a -> IO a
newtype Subst
Subst :: HashMap String Type -> Subst
[getSubst] :: Subst -> HashMap String Type
class IsType t
freeTVars :: IsType t => t -> HashSet String
applySubst :: IsType t => Subst -> t -> t
data Scheme
Scheme :: HashSet String -> Type -> Scheme
[schemeQuant] :: Scheme -> HashSet String
[schemeType] :: Scheme -> Type
freshTVar :: MonadTypecheck m => m Type
somewhatFreshTVar :: MonadTypecheck m => String -> m Type
mostGeneralUnifier :: MonadTypecheck m => Type -> Type -> m Subst
-- | Substitute n for t, given there's no collision
varBind :: MonadTypecheck m => String -> Type -> m Subst
data Context
Context :: HashMap String Scheme -> Int -> Context
[contextMap] :: Context -> HashMap String Scheme
[contextFresh] :: Context -> Int
initContext :: Context
removeTVar :: String -> Context -> Context
-- | Where we don't want to include variables bound by our context
quantify :: MonadTypecheck m => Type -> m Scheme
-- | Replaces bound variables with fresh ones
unQuantify :: MonadTypecheck m => Scheme -> m Type
typeOfTopLevel :: MonadTypecheck m => Expr -> m Type
data ExprType
TopLevel :: ExprType
DocLevel :: ExprType
typeInfer :: MonadTypecheck m => ExprType -> Expr -> m (Subst, Type)
instance GHC.Classes.Eq LText.Type.Type
instance GHC.Show.Show LText.Type.Type
instance GHC.Generics.Generic LText.Type.TypeError
instance GHC.Classes.Eq LText.Type.TypeError
instance GHC.Show.Show LText.Type.TypeError
instance GHC.Classes.Eq LText.Type.TypeEnv
instance GHC.Show.Show LText.Type.TypeEnv
instance GHC.Classes.Eq LText.Type.Subst
instance GHC.Show.Show LText.Type.Subst
instance GHC.Classes.Eq LText.Type.Scheme
instance GHC.Show.Show LText.Type.Scheme
instance GHC.Classes.Eq LText.Type.Context
instance GHC.Show.Show LText.Type.Context
instance LText.Type.IsType LText.Type.Context
instance LText.Type.IsType LText.Type.Scheme
instance GHC.Base.Semigroup LText.Type.Subst
instance LText.Type.IsType a => LText.Type.IsType [a]
instance LText.Type.IsType LText.Type.Type
instance GHC.Base.Monoid LText.Type.Subst
instance GHC.Exception.Type.Exception LText.Type.TypeError