Karya, built on Mon Jul 24 11:39:07 PDT 2017 (patch 33511aca01257b76b88de7c7a2763b7a965c084e)

Derive.Env

Contents

Synopsis

# typechecking

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.

Like put_val, but format the error msg.

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

Insert a val without typechecking.

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

Constructors

 NotFound WrongType !ValType.Type

Instances

 # MethodsshowList :: [LookupError] -> ShowS #

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.

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

type Key = Str Source #

Symbols to look up a val in the ValMap.

data Environ Source #

Instances

 # MethodsshowList :: [Environ] -> ShowS # # Methodsmconcat :: [Environ] -> Environ # # Methodsrnf :: Environ -> () # # MethodsformatList :: [Environ] -> Doc Source #

Insert a val directly, with no typechecking.