
Am Donnerstag 11 Februar 2010 23:04:01 schrieb kane96@gmx.de:
but the exercise was nearly complete on the sheet and I just have to complete two parts and one of them is to ask the user if he want's to do more input. If so, I have to let him input a new value (triple) for MyDatatype, otherwise I have to print the list with all triples
But to print it, you need to have a reference to the list of inputs. The easiest way is to have it as a parameter in the worker loop. What *exactly* is your task? What is given and what are the specifications for a solution?
Am Donnerstag 11 Februar 2010 22:34:45 schrieb kane96@gmx.de:
the problem is the function should be readMyDatatype :: IO MyDatatype readMyDatatype = do ... Is it possible to do it somehow different without a parameter?
Separate the worker from the API function.
API:
readMyDatatype :: IO MyDatatype readMyDatatype = call worker with appropriate arguments
worker:
readMD :: t1 -> t2 -> ... -> tn -> IO MyDatatype