[bitc-dev] DISCUSS: Name That Type Class!
Jonathan S. Shapiro
shap at eros-os.com
Sun Jul 20 16:20:48 CDT 2008
On Sun, 2008-07-20 at 17:12 -0400, Swaroop Sridhar wrote:
> For example, if we want to specify the type of a function that receives
> a reference to a pair whose components must be of fixed type (say
> (int32, bool)) but we don't care whether the pair itself is mutable or
> not. Using top-copy-compat, we can specify a type that is polymorphic
> over the mutability of the pair type. For example:
> (define (f x) x^.fst:int32 x^.snd:bool ())
> f: (forall ((top-copy-compat 'a (pair int32 bool)))
> (fn ((ref 'a)) ()))
I cannot figure out what this means, because the syntax is illegal.
Also, your example involves deep mutability variance, which is generally
NOT copy-compatible. Can you expand this example more clearly?
More information about the bitc-dev