Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | Isaac Elliott <isaace71295@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- module Language.Python.Validate.Scope.Error
- data Scope
- type ValidateScope ann e = ValidateM (NonEmpty e) (State (ScopeContext ann))
- runValidateScope :: ValidateScope ann e a -> Validation (NonEmpty e) a
- validateModuleScope :: AsScopeError e a => Module v a -> ValidateScope a e (Module (Nub (Scope ': v)) a)
- validateStatementScope :: AsScopeError e a => Statement v a -> ValidateScope a e (Statement (Nub (Scope ': v)) a)
- validateExprScope :: AsScopeError e a => Expr v a -> ValidateScope a e (Expr (Nub (Scope ': v)) a)
- data ScopeContext a = ScopeContext {
- _scGlobalScope :: !(Map ByteString a)
- _scLocalScope :: !(Map ByteString a)
- _scImmediateScope :: !(Map ByteString a)
- scGlobalScope :: forall a. Lens' (ScopeContext a) (Map ByteString a)
- scLocalScope :: forall a. Lens' (ScopeContext a) (Map ByteString a)
- scImmediateScope :: forall a. Lens' (ScopeContext a) (Map ByteString a)
- runValidateScope' :: ScopeContext ann -> ValidateScope ann e a -> Validation (NonEmpty e) a
- initialScopeContext :: ScopeContext a
- data Binding
- inScope :: MonadState (ScopeContext ann) m => String -> m (Maybe (Binding, ann))
- extendScope :: Setter' (ScopeContext ann) (Map ByteString ann) -> [(ann, String)] -> ValidateScope ann e ()
- locallyOver :: Lens' (ScopeContext ann) b -> (b -> b) -> ValidateScope ann e a -> ValidateScope ann e a
- locallyExtendOver :: Lens' (ScopeContext ann) (Map ByteString ann) -> [(ann, String)] -> ValidateScope ann e a -> ValidateScope ann e a
- validateArgScope :: AsScopeError e a => Arg v a -> ValidateScope a e (Arg (Nub (Scope ': v)) a)
- validateAssignExprScope :: AsScopeError e a => Expr v a -> ValidateScope a e (Expr (Nub (Scope ': v)) a)
- validateBlockScope :: AsScopeError e a => Block v a -> ValidateScope a e (Block (Nub (Scope ': v)) a)
- validateCompoundStatementScope :: forall e v a. AsScopeError e a => CompoundStatement v a -> ValidateScope a e (CompoundStatement (Nub (Scope ': v)) a)
- validateComprehensionScope :: AsScopeError e a => (ex v a -> ValidateScope a e (ex (Nub (Scope ': v)) a)) -> Comprehension ex v a -> ValidateScope a e (Comprehension ex (Nub (Scope ': v)) a)
- validateDecoratorScope :: AsScopeError e a => Decorator v a -> ValidateScope a e (Decorator (Nub (Scope ': v)) a)
- validateDictItemScope :: AsScopeError e a => DictItem v a -> ValidateScope a e (DictItem (Nub (Scope ': v)) a)
- validateExceptAsScope :: AsScopeError e a => ExceptAs v a -> ValidateScope a e (ExceptAs (Nub (Scope ': v)) a)
- validateIdentScope :: AsScopeError e a => Ident v a -> ValidateScope a e (Ident (Nub (Scope ': v)) a)
- validateListItemScope :: AsScopeError e a => ListItem v a -> ValidateScope a e (ListItem (Nub (Scope ': v)) a)
- validateParamScope :: AsScopeError e a => Param v a -> ValidateScope a e (Param (Nub (Scope ': v)) a)
- validateSetItemScope :: AsScopeError e a => SetItem v a -> ValidateScope a e (SetItem (Nub (Scope ': v)) a)
- validateSimpleStatementScope :: AsScopeError e a => SimpleStatement v a -> ValidateScope a e (SimpleStatement (Nub (Scope ': v)) a)
- validateSubscriptScope :: AsScopeError e a => Subscript v a -> ValidateScope a e (Subscript (Nub (Scope ': v)) a)
- validateSuiteScope :: AsScopeError e a => Suite v a -> ValidateScope a e (Suite (Nub (Scope ': v)) a)
- validateTupleItemScope :: AsScopeError e a => TupleItem v a -> ValidateScope a e (TupleItem (Nub (Scope ': v)) a)
Documentation
Main validation functions
type ValidateScope ann e = ValidateM (NonEmpty e) (State (ScopeContext ann)) Source #
runValidateScope :: ValidateScope ann e a -> Validation (NonEmpty e) a Source #
validateModuleScope :: AsScopeError e a => Module v a -> ValidateScope a e (Module (Nub (Scope ': v)) a) Source #
validateStatementScope :: AsScopeError e a => Statement v a -> ValidateScope a e (Statement (Nub (Scope ': v)) a) Source #
validateExprScope :: AsScopeError e a => Expr v a -> ValidateScope a e (Expr (Nub (Scope ': v)) a) Source #
Miscellany
Extra types
data ScopeContext a Source #
ScopeContext | |
|
Instances
Eq a => Eq (ScopeContext a) Source # | |
Defined in Language.Python.Validate.Scope (==) :: ScopeContext a -> ScopeContext a -> Bool # (/=) :: ScopeContext a -> ScopeContext a -> Bool # | |
Show a => Show (ScopeContext a) Source # | |
Defined in Language.Python.Validate.Scope showsPrec :: Int -> ScopeContext a -> ShowS # show :: ScopeContext a -> String # showList :: [ScopeContext a] -> ShowS # |
scGlobalScope :: forall a. Lens' (ScopeContext a) (Map ByteString a) Source #
scLocalScope :: forall a. Lens' (ScopeContext a) (Map ByteString a) Source #
scImmediateScope :: forall a. Lens' (ScopeContext a) (Map ByteString a) Source #
runValidateScope' :: ScopeContext ann -> ValidateScope ann e a -> Validation (NonEmpty e) a Source #
Extra functions
inScope :: MonadState (ScopeContext ann) m => String -> m (Maybe (Binding, ann)) Source #
extendScope :: Setter' (ScopeContext ann) (Map ByteString ann) -> [(ann, String)] -> ValidateScope ann e () Source #
locallyOver :: Lens' (ScopeContext ann) b -> (b -> b) -> ValidateScope ann e a -> ValidateScope ann e a Source #
locallyExtendOver :: Lens' (ScopeContext ann) (Map ByteString ann) -> [(ann, String)] -> ValidateScope ann e a -> ValidateScope ann e a Source #
Validation functions
validateArgScope :: AsScopeError e a => Arg v a -> ValidateScope a e (Arg (Nub (Scope ': v)) a) Source #
validateAssignExprScope :: AsScopeError e a => Expr v a -> ValidateScope a e (Expr (Nub (Scope ': v)) a) Source #
validateBlockScope :: AsScopeError e a => Block v a -> ValidateScope a e (Block (Nub (Scope ': v)) a) Source #
validateCompoundStatementScope :: forall e v a. AsScopeError e a => CompoundStatement v a -> ValidateScope a e (CompoundStatement (Nub (Scope ': v)) a) Source #
validateComprehensionScope :: AsScopeError e a => (ex v a -> ValidateScope a e (ex (Nub (Scope ': v)) a)) -> Comprehension ex v a -> ValidateScope a e (Comprehension ex (Nub (Scope ': v)) a) Source #
validateDecoratorScope :: AsScopeError e a => Decorator v a -> ValidateScope a e (Decorator (Nub (Scope ': v)) a) Source #
validateDictItemScope :: AsScopeError e a => DictItem v a -> ValidateScope a e (DictItem (Nub (Scope ': v)) a) Source #
validateExceptAsScope :: AsScopeError e a => ExceptAs v a -> ValidateScope a e (ExceptAs (Nub (Scope ': v)) a) Source #
validateIdentScope :: AsScopeError e a => Ident v a -> ValidateScope a e (Ident (Nub (Scope ': v)) a) Source #
validateListItemScope :: AsScopeError e a => ListItem v a -> ValidateScope a e (ListItem (Nub (Scope ': v)) a) Source #
validateParamScope :: AsScopeError e a => Param v a -> ValidateScope a e (Param (Nub (Scope ': v)) a) Source #
validateSetItemScope :: AsScopeError e a => SetItem v a -> ValidateScope a e (SetItem (Nub (Scope ': v)) a) Source #
validateSimpleStatementScope :: AsScopeError e a => SimpleStatement v a -> ValidateScope a e (SimpleStatement (Nub (Scope ': v)) a) Source #
validateSubscriptScope :: AsScopeError e a => Subscript v a -> ValidateScope a e (Subscript (Nub (Scope ': v)) a) Source #
validateSuiteScope :: AsScopeError e a => Suite v a -> ValidateScope a e (Suite (Nub (Scope ': v)) a) Source #
validateTupleItemScope :: AsScopeError e a => TupleItem v a -> ValidateScope a e (TupleItem (Nub (Scope ': v)) a) Source #