data-diverse-2.0.0.0: Extensible records and polymorphic variants.

Safe HaskellSafe
LanguageHaskell2010

Data.Diverse.Case

Synopsis

Documentation

class Case c xs where Source #

This class allows defining handlers that can handle the Head type in the xs typelist. In conjunction with Reiterate, you can define handlers that can handle all the types in the xs typelist.

See Data.Diverse.CaseFunc and Data.Diverse.Cases.

Minimal complete definition

case'

Methods

case' :: c xs -> Head xs -> CaseResult c (Head xs) Source #

Return the handler/continuation when x is observed.

Instances

k x => Case (CaseFunc' k) ((:) Type x xs) Source # 

Methods

case' :: CaseFunc' k ((Type ': x) xs) -> Head Type ((Type ': x) xs) -> CaseResult * Type (CaseFunc' k) (Head Type ((Type ': x) xs)) Source #

UniqueMember * (Head * xs -> r) fs => Case (Cases fs r) xs Source #

UndecidableInstances because fs appers more often.

Methods

case' :: Cases fs r xs -> Head Type xs -> CaseResult * Type (Cases fs r) (Head Type xs) Source #

k x => Case (CaseFunc k r) ((:) Type x xs) Source # 

Methods

case' :: CaseFunc k r ((Type ': x) xs) -> Head Type ((Type ': x) xs) -> CaseResult * Type (CaseFunc k r) (Head Type ((Type ': x) xs)) Source #

MemberAt * n (Head * xs -> r) fs => Case (CasesN fs r n) xs Source #

UndecidableInstances because fs appears more often.

Methods

case' :: CasesN fs r n xs -> Head Type xs -> CaseResult * Type (CasesN fs r n) (Head Type xs) Source #