ouroboros-consensus-test-0.1.0.0: Tests of the consensus layer
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Util.Classify

Contents

Description

Classification of lists of symbols

Intended for qualified import.

import qualified Test.Util.Classify as C
Synopsis

Documentation

data Predicate a b Source #

Predicate over a list of as, using classification b

Constructors

Predicate 

Fields

  • predApply ∷ a → Either b (Predicate a b)

    Given an a, either successfully classify as b or continue looking

  • predFinishMaybe b

    End of the string

    The predicate is given a final chance to return a value.

Instances

Instances details
Functor (Predicate a) Source # 
Instance details

Defined in Test.Util.Classify

Methods

fmap ∷ (a0 → b) → Predicate a a0 → Predicate a b Source #

(<$) ∷ a0 → Predicate a b → Predicate a a0 Source #

classify ∷ ∀ a b. [Predicate a b] → [a] → [b] Source #

Do a linear scan over the list, returning all successful classifications

maximum ∷ ∀ a b. Ord b ⇒ (a → Maybe b) → Predicate a b Source #

Maximum value found, if any

predicate ∷ (a → Either b (Predicate a b)) → Predicate a b Source #

Construct simply predicate that returns Nothing on termination

Example

data Tag Source #

Instances

Instances details
Show Tag Source # 
Instance details

Defined in Test.Util.Classify

Methods

showsPrecIntTagShowS Source #

showTagString Source #

showList ∷ [Tag] → ShowS Source #

example ∷ [Int] → [Tag] Source #