Karya, built on 2018-05-31T02:46:59 (patch 0a1a35479c514820d77330ae8a978975ba22a47a)

Safe HaskellNone

Derive.Env

Synopsis

Documentation

data LookupError Source #

Instances
Show LookupError # 
Instance details

Defined in Derive.Env

put_val :: Typecheck.ToVal a => Key -> a -> Environ -> Either ValType.Type Environ Source #

Insert a new val, but return Left if it changes the type of an existing one, so once you put a key of a given type into the environ, it can only ever be overwritten by a Val of the same type. The idea is that being inconsistent with types will just lead to confusion.

BaseTypes.VNotGiven is another special case, it deletes the given key.

put_val_error :: Typecheck.ToVal a => Key -> a -> Environ -> Either Text Environ Source #

Like put_val, but format the error msg.

insert_val :: Typecheck.ToVal a => Key -> a -> Environ -> Environ Source #

Insert a val without typechecking.

hardcoded_types :: Map Key ValType.Type Source #

If a standard val gets set to the wrong type, it will cause confusing errors later on.

maybe_val :: Typecheck.Typecheck a => Key -> Environ -> Maybe a Source #

Like get_val, except that type errors and not found both turn into Nothing.

checked_val :: forall a. Typecheck.Typecheck a => Key -> Environ -> Either Text (Maybe a) Source #

Like get_val but format a WrongType nicely.

checked_val2 :: Typecheck.Typecheck a => Key -> Environ -> Maybe (Either Text a) Source #

Like checked_val, but juggle the return type around so NotFound is just Nothing, which is more convenient in some cases.

type Key = Text Source #

Symbols to look up a val in the ValMap.

data Environ Source #

Instances
Show Environ # 
Instance details

Defined in Derive.BaseTypes

Semigroup Environ # 
Instance details

Defined in Derive.BaseTypes

Monoid Environ # 
Instance details

Defined in Derive.BaseTypes

NFData Environ # 
Instance details

Defined in Derive.BaseTypes

Methods

rnf :: Environ -> () #

Pretty Environ # 
Instance details

Defined in Derive.BaseTypes

insert :: Key -> BaseTypes.Val -> Environ -> Environ Source #

Insert a val directly, with no typechecking.