Thomas Engel <thomas.engel1@xxxxxxx> 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 ()
main = do i <- input_values
let o = calculate i
main = output_values . calculate =<< input_values
If I haven't seen further, it is by standing in the footprints of giants
Haskell-Cafe mailing list