stan-0.2.0.0: Haskell STatic ANalyser

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
  - (?) :: a
  - neg :: a -> a
  - (|||) :: a -> a -> a
  - (&&&) :: a -> a -> a

# 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`):

-     (?) ≡ True

-     neg (?) ≡ False

-     (?) ||| x ≡ x ||| (?) ≡ True

-     (?) &&& x ≡ x &&& (?) ≡ x

Methods

(?) :: a #

Anything. Matching should always return `True`.

neg :: a -> a #

Negation. Inverses the argument.

(|||) :: a -> a -> a infixr 2 #

Or-pattern. Choice.

(&&&) :: a -> a -> a infixr 3 #

And-pattern. Both.

#### Instances

Instances details

PatternBool PatternAst # |
Instance details Defined in Stan.Pattern.Ast Methods (?) :: PatternAst # neg :: PatternAst -> PatternAst # (|||) :: PatternAst -> PatternAst -> PatternAst # (&&&) :: PatternAst -> PatternAst -> PatternAst #
PatternBool PatternType # |
Instance details Defined in Stan.Pattern.Type Methods (?) :: PatternType # neg :: PatternType -> PatternType # (|||) :: PatternType -> PatternType -> PatternType # (&&&) :: PatternType -> PatternType -> PatternType #