extensible-0.3.7: Extensible, efficient, optics-friendly data types

Copyright(c) Fumiaki Kinoshita 2015
LicenseBSD3
MaintainerFumiaki Kinoshita <fumiexcel@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell2010

Data.Extensible.Match

Description

Pattern matching

Synopsis

Documentation

matchWith :: (forall x. f x -> g x -> r) -> (f :* xs) -> (g :| xs) -> r Source

Retrieve the contents so that they matches and pass both to the given function.

newtype Match h r x Source

Turn a wrapper type into a clause for it.

Constructors

Match 

Fields

runMatch :: h x -> r
 

Instances

Wrapper k h => Wrapper k (Match k h r) Source 
type Repr k (Match k h r) x = Repr k h x -> r Source 

match :: (Match h a :* xs) -> (h :| xs) -> a Source

O(log n) Perform pattern matching.

mapMatch :: (a -> b) -> Match h a x -> Match h b x Source

Applies a function to the result of Match.

caseOf :: (h :| xs) -> (Match h a :* xs) -> a infix 0 Source

Flipped match