The OrPatterns package

[Tags: bsd3, library]

A quasiquoter for or-patterns. It allows one additional form for patterns:

 f [o| p1 | p2 | p3 |] = rhs

Above, p1, p2 and p3 are three arbitrary patterns that bind the same variables. These variables are available in the expression rhs. Nesting of or-patterns is not supported yet.

See also:

 g :: Either (x, y) (y, x) -> (x, y)
 g [o| Left (x,y) | Right (y,x) |] = (x,y)
 -- ends up slightly longer
 g = elim $ left (pair var var) \/ right flipped ->> (,)
  where
   flipped = (\(a,b) -> (b,a)) --> pair var var

Properties

Version0.1
Dependenciesbase (>=4.5 && <4.8), containers (>=0.3 && <0.6), haskell-src-exts (==1.15.*), haskell-src-meta (==0.6.*), mtl (==2.1.*), split (==0.2.*), syb (==0.4.*), template-haskell (>=2.4 && <2.10)
LicenseBSD3
AuthorAdam Vogt <vogt.adam@gmail.com>
MaintainerAdam Vogt <vogt.adam@gmail.com>
CategoryDevelopment
Source repositoryhead: darcs get http://code.haskell.org/~aavogt/OrPatterns
Upload dateFri May 16 06:02:29 UTC 2014
Uploaded byAdamVogt
Downloads87 total (13 in last 30 days)

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees