pinchot-0.24.0.0: Write grammars, not parsers

Safe HaskellNone
LanguageHaskell2010

Pinchot.Examples.Newman

Description

This module provides a simple example of use of everything in Pinchot. address parses a postal address from a string and prints a simple report showing some of the elements of the address and their locations.

Synopsis

Documentation

labelLoc :: Loc -> String Source #

Formats a Loc for nice on-screen display.

labelOpt :: String -> [(Char, Loc)] -> String Source #

Labels a single field, where the field may or may not appear in a parsed result.

labelNE :: String -> NonEmpty (Char, Loc) -> String Source #

Labels a single field, where the field will always appear in a parsed result.

showAddress :: Address Char Loc -> String Source #

Formats a single Address for nice on-screen display.

showParseResult :: ([Address Char Loc], Report String [(Char, Loc)]) -> String Source #

Formats successful Address parses and the Report for nice on-screen display.

address :: String -> IO () Source #

Parse an address and print the resulting report. Good for use in GHCi.

addressPretty :: String -> IO () Source #

Like address but uses valToStr.

addressFromFile Source #

Arguments

:: String

Filename

-> IO () 

Read an address from a file and print the resulting report. Good for use in GHCi.