
using IORefs, one can construct linked lists in Haskell that resemble one's used in imperative C programming. eg, the following toy code creates a chain of 1000 linked records. import IOExts data Record= RecordNil | Record String Int Chain type Chain = IORef Record main=makeChain [1..1000] makeChain::[Int]->IO Chain makeChain []=newIORef RecordNil makeChain (a:as)=makeChain as>>= \chain-> newIORef (Record "data" a chain) such structures will be garbage-collected "automatically", right? in general terms, please comment on how well GHC supports code that uses such structures. (I have no reason to suspect it would not be well-supported, but it never hurts to verify assumptions before plunging into coding.) now, to turn makeChain into a "lazy producer" requires adding an IO to the type of Chain, yielding type Chain=IO (IORef Record) please comment on how well GHC would tend to support such a type.