Safe Haskell | Safe-Inferred |
---|
Synopsis
- type Key = Text
- data Environ
- null :: Environ -> Bool
- lookup :: Key -> Environ -> Maybe DeriveT.Val
- insert :: Key -> DeriveT.Val -> Environ -> Environ
- from_list :: [(Key, DeriveT.Val)] -> Environ
- to_list :: Environ -> [(Key, DeriveT.Val)]
- to_map :: Environ -> Map Key DeriveT.Val
- from_map :: Map Key DeriveT.Val -> Environ
- delete :: Key -> Environ -> Environ
- is_set :: Key -> Environ -> Bool
- map :: (DeriveT.Val -> DeriveT.Val) -> Environ -> Environ
- from_controls :: ScoreT.ControlMap -> Environ
- put_val :: Typecheck.ToVal a => Key -> a -> Environ -> Either Error Environ
- modify_signal :: (Maybe ScoreT.TypedSignal -> ScoreT.TypedSignal) -> Key -> Environ -> Either Error DeriveT.Val
- insert_val :: Typecheck.ToVal a => Key -> a -> Environ -> Environ
- data LookupError
- get_val :: Typecheck.Typecheck a => Key -> Environ -> Either LookupError a
- maybe_val :: Typecheck.Typecheck a => Key -> Environ -> Maybe a
- checked_val :: forall a. Typecheck.Typecheck a => Key -> Environ -> Either Text (Maybe a)
- checked_val2 :: Typecheck.Typecheck a => Key -> Environ -> Maybe (Either Text a)
Documentation
insert :: Key -> DeriveT.Val -> Environ -> Environ Source #
Insert a val directly, with no typechecking.
map :: (DeriveT.Val -> DeriveT.Val) -> Environ -> Environ Source #
put
put_val :: Typecheck.ToVal a => Key -> a -> Environ -> Either Error 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.
DeriveT.VNotGiven
is another special case, it deletes the given key.
modify_signal :: (Maybe ScoreT.TypedSignal -> ScoreT.TypedSignal) -> Key -> Environ -> Either Error DeriveT.Val Source #
insert_val :: Typecheck.ToVal a => Key -> a -> Environ -> Environ Source #
Insert a val without typechecking.
data LookupError Source #
Instances
Show LookupError Source # | |
Defined in Derive.Env showsPrec :: Int -> LookupError -> ShowS # show :: LookupError -> String # showList :: [LookupError] -> ShowS # |
get_val :: Typecheck.Typecheck a => Key -> Environ -> Either LookupError a Source #
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.