Manipulating Egison patterns: abstract syntax, parser, and pretty-printer

Version on this page:
LTS Haskell 18.28:
Stackage Nightly 2021-06-14:
Latest on Hackage:

See all snapshots egison-pattern-src appears in

BSD-3-Clause licensed by coord_e
Maintained by coord_e, Satoshi Egi
This version can be pinned in stack with:egison-pattern-src-,4197

Egison Pattern Source

Actions Status Actions Status Hackage Hackage Deps

The egison-pattern-src provides a standalone syntax definition for patterns in Egison programming language. This package enables you to embed Egison’s patterns in your parser (pretty-printer) by supplying expression and name parsers (printers) externally.


The following is a simplified syntax of pattern expressions where x, v, op and e are respectively names, variable names, user-defined infix operators and expressions in host language.

p ::= _                     (wildcard pattern)
    | $v                    (pattern variable)
    | #e                    (value pattern)
    | ?e                    (predicate pattern)
    | (p_1, p_2, ..., p_n)  (tuple pattern)
    | [p_1, p_2, ..., p_n]  (collection pattern)
    | p & p                 (and pattern)
    | p | p                 (or pattern)
    | !p                    (not pattern)
    | p op p                (user-defined infix pattern)
    | x p_1 p_2 ... p_n     (constructor pattern)


egison-pattern-src is distributed as open source software under the terms of the 3 clause BSD License. See LICENSE for details.


  • Fix use of external parsers to delimit input with ,, ), or ]
  • Enable to parse value expression in the form of #[1, 2, 3] without parentheses

Breaking changes:

  • Add a tuple pattern #12
  • Add a collection pattern #17
  • UnexpectedEndOfFile error variant is added for greedy parsers (change in #19)
  • The name of parsing file is passed in ParseMode, not in the argument of parseExpr (change in #19)
  • Fix syntax of constructor patterns #18
    • We do not require constructor patterns to be parenthaized

Non-breacking changes:

  • Add non-greedy parsers #19
    • Variants of parsers are provided via Parsable class
  • not patterns are now parsed as atom patterns (change in #18)
  • Source type constraint is now just a type class providing few additional methods to Stream (change in #19)

Nothing changed (updated as other two adaptor packages)

  • Initial Release