[Haskell-cafe] Updating doubly linked lists

S. Günther h8spawn at googlemail.com
Wed Dec 31 00:57:52 EST 2008


I was trying to wrap my head around the stuff at
http://haskell.org/haskellwiki/Tying_the_Knot (again)
and along the way came a question:
Is it possible to change a particular node of the
doubly linked list? That is to say, that would like
to have a function:
update :: DList a -> a -> DList a
update node newValue
returns a list where only the value at the node
which is passed in is set to the new Value and
all other values are the same. All this of course
in a pure way, that is without using (M/T/TM)Vars
or IORefs.
I do apologize if the answer is really obvious and
am thankfull for any hints.

Thanks in advance
Stephan Günther

More information about the Haskell-Cafe mailing list