On 27-Sep-1999, Alex Ferguson <[EMAIL PROTECTED]> wrote:
>
> Fergus Henderson, replying to me:
> > ghc does not offer any facility for type class casts.
>
> I'm not clear what's meant by this; are we speaking of some sort of
> conversion to a common _type_, in some manner?
Well, roughly speaking, I'm talking about a family of built-in functions
`cast<C>', where `C' is some type class, having type
data CastResult<C> = Failed | C t => Succeeded t
cast<C> :: t -> CastResult<C>
and with the semantics
cast<C> (x::t) | C t = Succeeded x
| otherwise = Failed
where `C t' in the guard is to be interpreted as a boolean expression
that returns True if the type `t' is an instance of the class `C',
and False otherwise. Here `t' is the type of the argument `x'.
--
Fergus Henderson <[EMAIL PROTECTED]> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED] | -- the last words of T. S. Garp.