fileShellF :: (c1 -> String, String -> String ⊕ c1, Maybe c1) -> String -> F c1 (InputMsg c1) -> F c2 d textFileShellF :: String -> F String (InputMsg String) -> F c d showReadFileShellF :: (Show a, Read a) => Maybe a -> String -> F a (InputMsg a) -> F c d
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) :: (c1 -> String, String -> String ⊕ c1, Maybe c1)
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 :: String
editor :: F c1 (InputMsg c1)
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.