On 22. Oct 2007, at 20:16 , Stefan O'Rear wrote:
This type signature means that 'port' is return type overloaded -
it can
return ANY kind of port, and the caller gets to choose. Which I don't
think is what you want.
True.
(Requires type family extension in GHC 6.8; an equivalent formulation
using the older (2000) functional dependancies is possible)
Thanks for mentioning functional dependencies. I tied together the C
and the P types like this:
> class Channel c p | c -> p where
> port :: c a -> IO (p a)
> data C a = C (P a)
> instance Channel C P where
> port (C p) = return p
Which works nicely.
Thanks,
Henrik
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe