Copyright | (c) 2020 Kowainik |
---|---|
License | MPL-2.0 |
Maintainer | Kowainik <xrom.xkov@gmail.com> |
Safe Haskell | None |
Language | Haskell2010 |
Stan.Pattern.Edsl
Description
Embedded DSL for patterns (AST and Type). Implemented using the Final Taggless approach.
Synopsis
- class PatternBool a where
Documentation
class PatternBool a where #
Common interface for Bool
-like parts of patterns. Allows to
write composable and reusable complex pattern definitions from smaller
pieces.
Laws (in terms of matching functions that return Bool
):
Methods
Anything. Matching should always return True
.
Negation. Inverses the argument.
(|||) :: a -> a -> a infixr 2 #
Or-pattern. Choice.
(&&&) :: a -> a -> a infixr 3 #
And-pattern. Both.
Instances
PatternBool PatternAst # | |
Defined in Stan.Pattern.Ast Methods (?) :: PatternAst # neg :: PatternAst -> PatternAst # (|||) :: PatternAst -> PatternAst -> PatternAst # (&&&) :: PatternAst -> PatternAst -> PatternAst # | |
PatternBool PatternType # | |
Defined in Stan.Pattern.Type Methods (?) :: PatternType # neg :: PatternType -> PatternType # (|||) :: PatternType -> PatternType -> PatternType # (&&&) :: PatternType -> PatternType -> PatternType # |