add something to a list

christophe certain christophe.certain@wanadoo.fr
Sun, 17 Feb 2002 09:20:07 +0100


Hi,

I'm a poor lonesome newbie in Haskell world, and I would like to add a string
typed on the prompt to a list of strings which is already defined.

It would look like something like :

type Path = [String]

currentPath::Path
currentPath = []

getpiece ::IO String
getpiece  =  do c <-getLine
		return c

putpiece:: String->Path
putpiece a = a:currentPath

and then I could combine the two functions, but obviously it doesn't work.
I dare understand that it's impossible isn't it ?

Maybe the only way is to create a new [String] each time I want to add a new 
string ? No ?

Christophe Certain