extensible-0.3.1: Extensible, efficient, lens-friendly data types

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

Data.Extensible.Match

Description

Pattern matching

Synopsis

Documentation

newtype Match h a x Source

Turn a wrapper type into one clause that returns a.

Constructors

Match 

Fields

runMatch :: h x -> a
 

Instances

Typeable ((k -> *) -> * -> k -> *) (Match k) 

clause :: x xs => Lens' (Match h a :* xs) (h x -> a) Source

A lens for a specific clause.

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