ermine-0.6: Ermine

Copyright(c) Edward Kmett, Dan Doel 2012-2013
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Ermine.Builtin.Pattern

Description

Smart builders for convenient building of patterns.

Synopsis

Documentation

data Binder v a Source

Constructors

Binder 

Fields

vars :: [v]
 
item :: a
 

Instances

Bitraversable Binder 
Bifunctor Binder 
Bifoldable Binder 
((~) (* -> * -> *) p (Tagged *), (~) (* -> *) f Identity, Tup (Tagged *) Identity t) => Tup p f (Binder v t) 
Functor (Binder v) 
Applicative (Binder v) 
Foldable (Binder v) 
Traversable (Binder v) 
Comonad (Binder v) 
(Eq v, Eq a) => Eq (Binder v a) 
(Ord v, Ord a) => Ord (Binder v a) 
(Read v, Read a) => Read (Binder v a) 
(Show v, Show a) => Show (Binder v a) 
IsString s => IsString (P (Annot t) s) 

note :: Binder v v -> Binder v v Source

If the annotation and item types correspond, we can push the item onto the annotations

noted :: v -> Binder v v Source

Injects a value into a binder, placing the value in the annotations as well.

type P t v = Binder v (Pattern t) Source

Smart pattern

varp :: v -> P (Annot t) v Source

A pattern that binds a variable with (effectively) no type annotation.

sigp :: v -> t -> P t v Source

A pattern that binds a variable with a type annotation.

_p :: P t v Source

A wildcard pattern that ignores its argument

strictp :: P t v -> P t v Source

A strict (bang) pattern

lazyp :: P t v -> P t v Source

A lazy (irrefutable) pattern

asp :: v -> P t v -> P t v Source

An as (@) pattern.

conp :: Global -> [P t v] -> P t v Source

A pattern that matches a constructor expression, with a specified number of unboxed arguments.

litp :: Literal -> P t v Source

A pattern that matches a literal unboxed value

alt :: (Monad f, Eq v) => P t v -> Guarded (f v) -> Alt t f v Source

smart alt constructor