Another question about sharing

Simon Marlow simonmar@microsoft.com
Mon, 10 Dec 2001 11:18:52 -0000


> If I have..
> 	data Path =3D L Path | R Path | T
> 	paths =3D T : branch paths
> 	branch (p:ps) =3D L p : R p : branch ps
>=20
> This will be a CAF which can never be garbage collected, but
> may grow indefinitely large as it gets reduced. Correct?

GHC will collect the CAF when it can determine that it is no longer
required.  In GHCi, the CAF will only be collected if you turn on ':set
+r', otherwise evaluated CAFs are retained between evaluations.

Cheers,
	Simon