Portability | portable |
---|---|
Stability | experimental |
Maintainer | yi-devel@googlegroups.com |
Safe Haskell | Safe-Inferred |
Support for OO-like prototypes.
Documentation
A prototype. Typically the parameter will be a record type. Fields can be defined in terms of others fields, with the idea that some of these definitons can be overridden.
Example:
data O = O {f1, f2, f3 :: Int} deriving Show o1 = Proto $ \self -> O { f1 = 1, f2 = f1 self + 1, -- 'f1 self' refers to the overriden definition of f1 f3 = f1 self + 2 }
Calling
would then produce extractValue
o1O {f1 = 1, f2 = 2, f3 = 3}
.
extractValue :: Proto t -> tSource
Get the value of a prototype. This can return bottom in case some fields are recursively defined in terms of each other.