regexdot-0.11.1.1: A polymorphic, POSIX, extended regex-engine.

Safe HaskellSafe-Inferred
LanguageHaskell98

RegExDot.BracketExpressionMember

Contents

Description

AUTHOR
Dr. Alistair Ward
DESCRIPTION

Permits Perl-style shortcuts to be canned & assigned a single-Char mnemonic for subsequent reference; the implementation of Read looks for a back-slashed Char, for which it expects there to be a corresponding canned ShowablePredicate.

CAVEATS

Since the underlying polymorphic data-type isn't required to implement neither Enum nor Ord, the implementation of Read can't cope with range-specifications. Lacking this, Bracket-expression members must be enumerated exhaustively.

Synopsis

Type-classes

class ShortcutExpander a where Source

  • The interface via which Perl-style shortcuts are expanded (when they occur within a bracket-expression), in a manner appropriate to the chosen type-parameter.
  • The expansion of Perl-style shortcuts, is more restricted inside than outside, a bracket-expression, & consequently are merely represented here by a ShowablePredicate, rather than providing a more general form suitable also for those Perl-style shortcuts found outside bracket-expressions.
  • This interface is implemented elsewhere, where the specific type-parameter & consequently the appropriate set of Perl-style shortcuts, are defined.

Methods

findPredicate Source

Arguments

:: Char 
-> Maybe (ShowablePredicate a)

Attempt to find the appropriate ShowablePredicate to implement this Perl-style shortcut.

Types

Data-types

data Member m Source

  • A BracketExpression can contain either a literal, a range of literals given (Enum a, Ord a), a Perl-style shortcut, or when Char is the type-parameter, a POSIX Character-class.
  • This data-type reduces the representation of all these possibilities to either a predicate or a literal.

Constructors

Predicate (ShowablePredicate m)

This Member is described using a predicate, which is run to determine whether the datum conforms & is a member of the BracketExpression.

Literal m

This Member is defined literally, using an item of the polymorphic type.

Instances

Eq m => Eq (Member m) 
(ShortcutExpander m, Read m) => Read (Member m) 
Show m => Show (Member m) 
NFData m => NFData (Member m) 

Functions

Operators

(=~) infix 4 Source

Arguments

:: Eq m 
=> m

The input datum.

-> Member m

The member of the bracket-expression against which the input-datum is to be matched.

-> Bool

The result of the match-operation.

Match-operator.