DDC/PolymorphicUpdate

From HaskellWiki
< DDC
Revision as of 06:10, 19 March 2008 by Benl23 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Get/Set

Consider the following function:

makeGetSet :: a -> (() -> a, a -> ())
makeGetSet x
 = do 	box	= Just x
	get ()	= case box of { Just z -> z; }
	set z	= box#x #= z
	(get, set)