>
> They do need to be part of the type system because their misuse leads
> to unsoundness, but requiring that different classifications of
> mutability be distinct types seems to lead to awkwardness when you're
> just trying to implement something with reasonable variance over
> mutability.
Surely you just need a 'const' type as in C++, and if you cannot cast away
const (you can only cast to const) it seems safe.
So:
instance Assignable x where
(=) :: x -> x -> IO ()
instance Assignable x where
(=) :: x -> Const x -> IO ()
then:
Const Int // immutable value
Const (Pointer Int) // an immutable pointer to a mutable value
Pointer (Const Int) // a mutable pointer to an immutable value
etc...
Keean.
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev