hbro-1.1.2.0: Minimal KISS compliant browser

Safe HaskellNone

Hbro.Prompt

Description

Designed to be imported as qualified.

Synopsis

Documentation

data PromptBar m Source

Constructors

PromptBar 

Fields

_box :: HBox
 
_description :: Label
 
_entry :: Entry
 
_onChanged :: IORef (String -> m ())
 
_onValidated :: IORef (String -> m ())
 

Instances

onChanged :: forall m. Lens' (PromptBar m) (IORef (String -> m ()))Source

onValidated :: forall m. Lens' (PromptBar m) (IORef (String -> m ()))Source

entry :: forall m. Lens' (PromptBar m) EntrySource

box :: forall m. Lens' (PromptBar m) HBoxSource

class (Monad m, Monad n) => PromptReader n m | m -> n whereSource

Methods

readPrompt :: Simple Lens (PromptBar n) a -> m aSource

Instances

hide :: (MonadBase IO m, PromptReader n m) => m ()Source

clean :: (MonadBase IO m, PromptReader n m) => m ()Source

Close prompt, clean its content and callbacks

readSource

Arguments

:: (MonadBaseControl IO m, PromptReader m m, Error e, MonadError e m, MonadWriter String m) 
=> String

Prompt description

-> String

Initial value

-> (String -> m ())

Function to trigger when validating prompt value

-> m () 

Open prompt bar with given description and default value, and register a callback to trigger at validation.

incrementalRead :: (MonadBase IO m, MonadBaseControl IO m, PromptReader m m, Error e, MonadError e m, MonadWriter String m) => String -> String -> (String -> m ()) -> m ()Source

Same as read, but callback is triggered for each change in prompt's entry.

iread :: (MonadBaseControl IO m, PromptReader m m, Error e, MonadError e m, MonadWriter String m) => String -> String -> (String -> m ()) -> m ()Source

Alias for incrementalRead.

readURI :: (MonadBase IO m, PromptReader m m, MonadError HError m, MonadWriter String m) => String -> String -> (URI -> m ()) -> m ()Source

Same as read for URI values