On Mar 25, 2008, at 09:13, Thomas Engel wrote:
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. So what
should I
use in haskell?
(I think I know enough haskell to answer this, but I may be telling
you all the wrong things.)
You'll have to pass the values through, though this can be hidden to
some extent. Try changing your functions to have types
type Input = (Float, Float, ...)
type Output = (Float, Float, ...)
inputvalues :: IO Input -- add a "return (ve,de,...)" to the end
compute :: Input -> Output
outputvalues :: Output -> IO ()
You could then wrap them in
main :: IO ()
main = do input <- inputvalues
outputvalues (compute input)
This should do what you want.
It might be improved upon by using data types with appropriately named
fields instead of tuples so as to keep your variable names around.
Cheers
Robert
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe