stan-0.1.2.1: Haskell STatic ANalyser
Copyright(c) 2020 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
Safe HaskellSafe-Inferred
LanguageHaskell2010

Stan.Pattern.Type

Description

Patterns for types and type search.

Synopsis

Type

data PatternType Source #

Query pattern used to search types in HIE AST.

Constructors

PatternTypeName !NameMeta ![PatternType]

Argument, type or constructor:

aPatternName (NameMeta ... "a") []
[a] PatternName (NameMeta ... "List") [aPattern] (after GHC 9.6) PatternName (NameMeta ... "[]") [aPattern] (before GHC 9.6)
Either Int StringPatternName (NameMeta ... "Either") [intPattern, stringPattern]
PatternTypeFun !PatternType !PatternType

Function pattern.

PatternTypeAnything

Type wildcard, matches anything.

PatternTypeOr !PatternType !PatternType

Choice between patterns. Should match either of them.

PatternTypeAnd !PatternType !PatternType

Union of patterns. Should match both of them.

PatternTypeNeg !PatternType

Negation of pattern. Should match everything except this pattern.

eDSL

(|->) :: PatternType -> PatternType -> PatternType infixr 4 Source #

Short operator alias for PatternFun.

(|::) :: NameMeta -> [PatternType] -> PatternType infix 5 Source #

Short operator alias for PatternTypeName.

Common PatternTypes

listFunPattern :: PatternType Source #

PatternType for [a] -> _ or String -> _.

Textual types

Foldable patterns

foldableTypesPatterns :: NonEmpty PatternType Source #

List of types for STAN-0207.

foldableMethodsPatterns :: NonEmpty (NameMeta, PatternType -> PatternType) Source #

Type patterns for the Foldable typeclass methods. Represented as a non-empty list of pairs:

  • Method name
  • Function from type to pattern (where things like Maybe, Either should be)