fileShellF :: (a -> String, String -> Either String a, Maybe a) -> [Char] -> F a (InputMsg a) -> F b c textFileShellF :: [Char] -> F String (InputMsg String) -> F a b showReadFileShellF :: (Read a, Show a) => Maybe a -> [Char] -> F a (InputMsg a) -> F b c
fileShellF (show,parse,optEmpty) title editor
New, Open, Save, Save As and Quit.
The documents that are edited can be of any type, provided there is a way to
convert the values to and from strings that can be saved in files.
With fileShellF, conversion functions are supplied explicitly.
With showReadFileShellF the methods of the Show and Read
classes are used for conversion. With textFileShellF, no conversion is
performed.
(show,parse,optEmpty) :: (a -> String, String -> Either String a, Maybe a)show is applied to the value before it is saved in a
file. The function parse is applied to the contents
of openned files. If the value optEmpty is
Just empty, empty is sent to the editor fudget
when the command New is selected from the menu.
title :: [Char]
editor :: F a (InputMsg a)Save and Save As commands will
save the most resently output value.
main = fudlogue $ textFileShellF "Text Editor" (scrollF inputEditorF)
This is all that is needed to create a simple text editor.
Customisable versions: fileShellF' et al.
There is currently no good way of adding a conventional Edit menu
to the menu bar.