digestive-functors-0.2.0.1: A general way to consume input using applicative functors

Text.Digestive.Cli

Description

Proof-of-concept module: use digestive functors for a command line interface prompt

Synopsis

Documentation

type Prompt a = Form IO String String PromptView aSource

Type for a prompt

promptSource

Arguments

:: String

Description

-> Prompt String

Resulting prompt

Generate a prompt field for a String

promptListSource

Arguments

:: String

Description of resulting multi-prompt

-> Prompt a

Prompt to convert

-> Prompt [a]

Resulting multiple input prompt

Convert a prompt for a single item into a prompt for multiple items

promptReadSource

Arguments

:: Read a 
=> String

Error when the value can't be read

-> String

Description

-> Prompt a

Resulting prompt

Generate a prompt field for a value which can be read

runPromptSource

Arguments

:: Prompt a

The Prompt to run

-> IO (Either [String] a)

A list of error strings, or the result.

Run a Prompt, sequentially prompting the user for each item.