
Hi, Can someone please send me a working example based on the contents posted in the URL below? http://yi-editor.blogspot.com/2008/12/prototypes-encoding-oo-style.html Thanks, Kashyap

Kashyap,
Can someone please send me a working example based on the contents posted in the URL below?
There's a small typo in the post: the definition of Proto should read data Proto = Proto {a :: A, b :: B, c :: C} The rest seems fine to me. (See below for an excerpt). Cheers, Stefan ------------------------------------------- import Data.Function (fix) data A = A B C ; fa = A data B = B A C ; fb = B data C = C A B ; fc = C userFunction = C data Proto = Proto {a :: A, b :: B, c :: C} proto = \self -> Proto { a = fa (b self) (c self), b = fb (a self) (c self), c = fc (a self) (b self) } customizedProto = \self -> proto self { c = userFunction (a self) (b self) } customizedABC = fix customizedProto
participants (2)
-
CK Kashyap
-
Stefan Holdermans