[Haskell-cafe] How to variables
robert dockins
robdockins at fastmail.fm
Mon Jul 18 15:41:47 EDT 2005
>>>>>I'm doing a 3D simulation. Now I need something like variables in
>>>>>imperative languages. My mainLoop check for new events and renders
>>>>>scene.
>>>>
>>>>Then you want IORef.
>>>>http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data.IORef.html
>>>>
>>>
>>>I saw it. The problem is, I need an amount of 100*X of mutable variables
>>>to implement the system (camera position, rotation, aceleration, ...,
>>>position and deformetion infomations for every object, ..., renderer
>>>situations [like temprary fading and other efects], ... and more)
>>
>>Then you probably want a big labeled record,
>
>
> Uhm... and what if I write some runtines in plain C, then bind them to
> Haskell and and use then as in OOP:
[snip]
> Is this apoarch safe enougth, what do you think?
If you do it carefully. But why? It sounds like you are planning to
write a transliteration of the code you would write in C, without
leveraging the advantages of Haskell. Which brings us to the critical
question; what properties of Haskell cause you to want to develop your
program using it? The answer to that question should direct your design
choices.
More information about the Haskell-Cafe
mailing list