[Haskell-cafe] How to variables

yin yin at atom.sk
Mon Jul 18 15:35:43 EDT 2005

Hello all!

I'm doing a 3D simulation. Now I need something like variables in
imperative languages. My mainLoop check for new events and renders
scene. To use input for controling camera position I need variables. An
equivalent code in C:

  void main_loop() {
    int loop_num = 0;
    bool run = 1;
    SDLEvent e;

    while(run) {
      while(SDL_PollEvent(&e)) {
          if(e.type == SDL_KeyDown) {
           if(... == SDLK_Left)
          } else if ...

How to implement camera_pos_x, y and z as variables, which chage values
in run? This is only simplified example, but it's important to implement
it in as most imperative form as possible.

Thank fo all answers.

Matej 'Yin' Gagyi

More information about the Haskell-Cafe mailing list