Thomas Engel <[EMAIL PROTECTED]> writes:

> My problem is: How can I get the input values into the calculations and back
> the result to the output.

> In an other language I would use global variables for this. 

That would be bad style.

> An other point is that I want to separate the input from the calculations and
> the output.

> So what should I use in haskell?

I think your pseudocode is right on track.

> inputvalues  ::  IO ()

The most obvious way to do it would be to define

    data Input = ...
    data Output = ...

    input_values :: IO Input
    
    calculate :: Input -> Output
    
    ouput_values :: Output -> IO ()

then:

    main = do i <- input_values
              let o = calculate i
              output_values o

or:  
    main = output_values . calculate =<< input_values

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to