summoner-1.2.0: Tool for scaffolding completely configured production Haskell projects.

Summoner.Question

Description

This module contains function to proper questioning in terminal.

Synopsis

# Choose functions.

Arguments

 :: Show a => (Text -> Maybe a) Parse function -> Text Question text. -> [a] List of available options. -> IO a The chosen option.

Allows users to choose one of the given options. It asks the question until the appropriate answer is received.

Arguments

 :: YesNoPrompt Target and Prompt -> IO a action for Y answer -> IO a action for N answer -> IO a

Like choose but the possible answer are Y or N.

Like chooseYesNo but returns Bool.

# YesNoPrompt

Build a prompt

For example,

YesNoPrompt
{ yesNoTarget = Cabal
, yesNoPrompt = "Do you want to add a cabal integration?"}


will generate a following prompt message to the user

Do you want to add a cabal integration? [y]/n
-> y
[Cabal] will be added to the project


Constructors

 YesNoPrompt FieldsyesNoTarget :: Texttarget (e.g., TARGET will be added to the project)yesNoPrompt :: Textprompt (e.g., PROMPT [y]/n)

Arguments

 :: Text target name -> YesNoPrompt

Build a prompt with the TARGET name only

It will generate a simple default prompt such that

Add TARGET? [y]/n


# Queries

  Short project description:
->


Like query but has the default answer if no answer is specified.

queryManyRepeatOnFail :: forall a. (Text -> Maybe a) -> IO [a] Source #

Queries many answers. If answers are not parsable shows the failing part and queries again

# Customize target message

The message after yes/no questions. The output depends on the answer.

  Benchmarks will be added to the project


Like targetMessageWithText but the text is "added to the project"