howl-0.1.0.0: A small Wolfram Language interpreter and symbolic rewriting library
Safe HaskellNone
LanguageGHC2021

Howl.Builtins.Context

Description

Builtins and helpers for working with evaluation contexts.

This module provides functions for parsing and evaluating input, defining rules with Set/SetDelayed semantics, and installing the standard context-related builtins.

Synopsis

Documentation

data LHS #

A left-hand side that can appear in Set or SetDelayed.

Constructors

LHSSymbol Symbol

A plain symbol left-hand side such as x.

LHSPat Expr

A pattern left-hand side such as f[x_].

LHSTaggedPat Symbol Expr

A tagged pattern left-hand side such as tag /: f[x_] := rhs.

Instances

Instances details
Show LHS # 
Instance details

Defined in Howl.Builtins.Context

Methods

showsPrec :: Int -> LHS -> ShowS #

show :: LHS -> String #

showList :: [LHS] -> ShowS #

FromExpr LHS # 
Instance details

Defined in Howl.Builtins.Context

Methods

fromExpr :: Expr -> Maybe LHS #

addContextBuiltins :: Eval () #

Add the standard context-related builtins to the current context.

setDef :: LHS -> Expr -> Eval Expr #

Define a rule with Set semantics.

setDelayedDef :: LHS -> Expr -> Eval () #

Define a rule with SetDelayed semantics.

run :: Text -> Eval Expr #

Parse and evaluate an expression from Text.

run_ :: Text -> Eval () #

Parse and evaluate an expression from Text, discarding the result.

get :: FilePath -> Eval Expr #

Read, parse, and evaluate an expression from a file. The expression may be a compound expression, e.g. a sequence of semicolon-separated subexpressions.

get_ :: FilePath -> Eval () #

Read, parse, and evaluate an expression from a file, discarding the result.

evalWithHistory :: Expr -> Eval (Int, Expr) #

Evaluate an expression and record it in the In/Out history.