nero-0.1.1: Lens-based HTTP toolkit

Safe HaskellSafe-Inferred
LanguageHaskell2010

Nero.Match

Contents

Description

This module is mostly used for routing Requests based on their Path. It can also be used for matching with any arbitrary Text source.

Synopsis

Pattern

type Pattern = [Pat] Source

A pattern.

data Pat Source

One part of Pattern.

Instances

data Value Source

A monomorphic wrapper for polymorphic results. Makes it easier to deal with lists of matches.

Instances

text :: Pattern Source

A Pattern that captures anything.

text_ :: Text -> Pattern Source

Creates a Pattern from the given text discarding the match. When writing Patterns directly in source code, you may prefer to use the IsString instance of Pattern.

int :: Pattern Source

A Pattern that captures any Int.

Match

type Matcher a = Prism' Text a Source

Represents a Prism' from arbitrary Text to a Target result.

class Target a where Source

Helper class to support polymorphic target results.

Methods

target :: Prism' [Value] a Source

match :: Target a => Pattern -> Matcher a Source

Creates a Matcher from the given Pattern.