[Haskell-beginners] question for advice on packages for a retro-style pocket money ledger program

Benjamin L. Russell DekuDekuplex at Yahoo.com
Wed May 25 12:19:50 CEST 2011


For some time, I have been considering rewriting my original pocket
money ledger program in Haskell, but am not sure as to which packages
would be most useful.  My original pocket money ledger program was first
written in circa 1983 in N80-BASIC (a JIS-compatible ROM-based line
BASIC) on an NEC PC-8001 mkII [1].

The main difficulty is that I would like to preserve the original look
and feel of my original program while still rewriting it in Haskell.
However, my original program ran in an age before any kind of
Macintosh-style or Windows-style GUI had become common, and used basic
built-in ROM-based graphics and sound commands to draw a double-line
colored graphical border on a centered-colored-text screen, and saved
files to a floppy disk drive (floppy disks were actually considered
advanced for that age, since most personal computers then used a
cassette tape drive for external file storage).

As a result, I am uncertain as to which packages would be useful for
preserving the original look and feel of my program.  At minimum, I
would like my program to exhibit the following behavior:

1. Start out by drawing a lime-green-colored double two-pixel wide box
surrounding the screen, with the title and author name displayed as
separately-colored text centered in the screen.

2. If possible, play a suitable music file while on this screen.  Also,
display an option to mute this music, and if this music is once muted,
save this option for future runs of this program, so that the program
will start out with the music muted as the default option.  Also,
display an option to control the volume of this music, and if possible,
also display a separate option to choose a different tune to play.  The
tunes should be selectable from a selectable, expandable menu.

3. If possible, include a suitable screen saver to be displayed
automatically, separate from the GUI screen saver, upon a user-defined
period in which there has been no user input.  The screen saver should
be configurable in a separate configuration menu.

4. Upon the user hitting the Return key, stop playing the music (if
playing), and move to the main menu screen.

5. The options displayed in the menu screen should include, at minimum,
the following:

  a. Create a new ledger book.

  b. Load a ledger book (preferably from floppy disk).

  c. Add an entry to the ledger book.

  d. Delete an entry from the ledger book.

  e. Erase the ledger book.

  f. Save the current ledger book (preferably to floppy disk).

  g. Tabulate and display income and expenditures (leads to a separate
  screen requesting a time period for tabulation).  (The income and
  expenditures should be displayed in detail both as numerical charts
  and as colored graphs in a preferred form (pie chart, bar graph,
  etc.).)

  h. Set configuration options (leads to a separate screen for
  configuring default background music, default volume, default
  application screen saver, default theme, default fonts, default menu
  behavior, default keyboard remappings, default screen height/width
  ratio, etc.).

  i. Exit the application.

5. For each option (except for option i), move to a separate sub-menu
screen.  When input/output and processing have been completed on the
separate sub-menu screen, return to the main menu screen.

Most of the functionality of this program is related to some form of
input and output:  colored formatted combined graphical and textual
title screen with background music, manual data entry by a user, saving
files to a floppy disk, reading files off a floppy disk, deleting files
from a floppy disk, configuring various default music/volume/screen
saver/theme/font/menu behavior/keyboard remapping/screen height and
width ratio options, and combined numerical and graphical representation
of statistical ledger information.  Most of the computation involves
only simple arithmetic (mainly addition and subtraction, with perhaps
some multiplication and/or division, and no matrix manipulation).

The main point of this program is that program usage should be
interactive, and not require a separately entered file.  The idea is
that the program will play the role of an interactive personal ledger
assistant.

However, I am not sure as to how to implement this program in Haskell
easily.  Because most of the program is mainly concerned with side
effects, it is difficult to write it easily while preserving referential
transparency.  This type of program seems relatively straightforward to
write in N80-BASIC (which is no longer available in the original
version), but is relatively less trivial in a purely functional
programming language such as Haskell.  However, I am tired of spaghetti
code, and although writing each line of code in N80-BASIC is trivial,
managing control flow is not.  It is very difficult to manage control
flow without writing spaghetti code in a dialect of line BASIC.
However, most of the associated graphics and sound commands are
proprietary and implementation-dependent, and I am not sure how to
rewrite that part of the functionality in an implementation-independent
language without spending lots of time on API-related issues.

-- Benjamin L. Russell

[1] _OLD-COMPUTERS.COM Museum ~ NEC PC 8001 MK 2_. NYI (New York
Internet). n.d. Web. May 25,
2011. <http://www.old-computers.com/museum/computer.asp?st=1&c=396>.
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 90-6526-1406
"Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^




More information about the Beginners mailing list