-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Create simple list editor interfaces -- -- Create simple interfaces which allow the user to edit lists using -- various simple commands (move back, move forward, modify current -- element, etc). @package zipedit @version 0.1 -- | A library for creating simple interactive list editors, using a zipper -- to allow the user to navigate forward and back within the list and -- edit the list elements. module System.Console.ZipEdit -- | Actions that can be taken by an editor in response to user input. data Action a -- | move forward one item. Fwd :: Action a -- | move back one item. Back :: Action a -- | delete the current item. Delete :: Action a -- | modify the current item by applying the given function. Modify :: (a -> a) -> Action a -- | modify all items following the current item by applying the given -- function. ModifyFwd :: (a -> a) -> Action a -- | modify all items before the current item by applying the given -- function. ModifyBack :: (a -> a) -> Action a -- | Using the given string as a prompt, obtain a line of user input, and -- apply the given function to the user input to obtain a function for -- modifying the current item. ModifyWInp :: String -> (String -> a -> a) -> Action a -- | Using the given string as a prompt, obtain a line of user input, and -- apply the given function to the user input to obtain a new item, which -- should be inserted forward of the current item. The inserted item -- becomes the new current item. InsFwd :: String -> (String -> a) -> Action a -- | Similar to InsFwd, except that the new item is inserted before the old -- current item. InsBack :: String -> (String -> a) -> Action a -- | output a string which is a function of the current item. Output :: (a -> String) -> Action a -- | cancel the editing session. Cancel :: Action a -- | complete the editing session. Done :: Action a -- | perform a sequence of actions. Seq :: [Action a] -> Action a -- | Some standard actions which can be used in constructing editor -- configurations. The actions are: j - Fwd, k - Back, x - Delete, q - -- Cancel, d - Done. stdActions :: [(Char, Action a)] -- | A configuration record determining the behavior of the editor. data EditorConf a EC :: (a -> String) -> (a -> String) -> String -> [(Char, Action a)] -> EditorConf a -- | How to display the current item. display :: EditorConf a -> a -> String -- | How to display a prompt to the user. prompt :: EditorConf a -> a -> String -- | What to display as a prompt if there is no current item. emptyPrompt :: EditorConf a -> String -- | A list specifying the actions to take in response to user inputs. actions :: EditorConf a -> [(Char, Action a)] -- | Run the given editor on the given list, returning Nothing if -- the user canceled the editing process, or Just l if the -- editing process completed successfully, where l is the final -- state of the list being edited. edit :: EditorConf a -> [a] -> IO (Maybe [a]) instance Functor (Editor e) instance Monad (Editor e) instance MonadState (Context e) (Editor e) instance MonadReader (EditorConf e) (Editor e) instance MonadIO (Editor e) instance Functor LZipper