[Haskell-cafe] How to variables

Bulat Ziganshin bulatz at HotPOP.com
Tue Jul 19 02:11:05 EDT 2005

Hello yin,

Tuesday, July 19, 2005, 12:39:24 AM, you wrote:

y> I saw it. The problem is, I need an amount of 100*X of mutable variables
y> to implement the system (camera position, rotation, aceleration, ...,
y> position and deformetion infomations for every object, ..., renderer
y> situations [like temprary fading and other efects], ... and more)

you can use global variables, records, impicit parameters. careful
deisigning in terms which procedure needs which variables and which
variables must be joined in records because them used together will
help you. some data can belong just to modules where used, some data
are better to convert into functions (for example, i convert regular
expressions into functions checking match with that regular

i recommend you to see examples of imperative programs written in
Haskell, including my own (freearc.narod.ru), Yi editor
(ftp://ftp.cse.unsw.edu.au/pub/users/dons/yi/yi-0.1.0.tar.gz), web server 
written by authors of GHC, PostMaster mail server

my own program are extensively commented in Russian, plus
contains examples of calling C routines which then calls back to
Haskell using given code thunks (see Compress.hs)

writing imperative program in Haskell is not as convenient as in C
because all I/O and reading/writing variables must be coded as
separate actions. but on the other side, you will get all the benefits
of power data manipulations and also can invent your own control
structures. you can find in my Utils.hs a number of such small helpers

Best regards,
 Bulat                            mailto:bulatz at HotPOP.com

More information about the Haskell-Cafe mailing list