[Haskell-beginners] consing an element to a list inside a file
kane96 at gmx.de
kane96 at gmx.de
Thu Feb 11 16:34:45 EST 2010
the problem is the function should be
readMyDatatype :: IO MyDatatype
readMyDatatype = do ...
Is it possible to do it somehow different without a parameter?
-------- Original-Nachricht --------
> Datum: Thu, 11 Feb 2010 21:41:15 +0100
> Von: Daniel Fischer <daniel.is.fischer at web.de>
> An: kane96 at gmx.de
> CC: beginners at haskell.org
> Betreff: Re: [Haskell-beginners] consing an element to a list inside a file
> Am Donnerstag 11 Februar 2010 21:09:37 schrieb kane96 at gmx.de:
> > mysecondlist = 0:mylist
> >
> > that's was I was searching for, but how can I add the element to the
> > same list?
>
> You can't. When you add an element to a list, it's a different list.
>
> > I have to get any number of inputs from the user and at the
> > end, if he doesn't want to make more inputs, I have to print a list with
> > all the inputs he did.
>
> Make the list a parameter of the input loop.
>
> getInputs previous = do
> user <- getUserInput
> if endNow user
> then printList previous
> else getInputs (user:previous)
--
NEU: Mit GMX DSL über 1000,- ¿ sparen!
http://portal.gmx.net/de/go/dsl02
More information about the Beginners
mailing list