7 Feb
2001
7 Feb
'01
11:40 p.m.
Hello! On Wed, Feb 07, 2001 at 05:43:40PM -0500, Dylan Thurston wrote:
[...]
class Subtype a b where {- a is subtype of b, if following operations exist -} inject :: a -> b project :: b -> Maybe a
Shouldn't this be a subclass? 'project' is not always easy or possible to define.
Good question. The term subclass is, however, not according to Haskell's type system. Therefore: class Subtype a b where inject :: a -> b class Subtype a b => ProjectableSubtype a b where project :: b -> Maybe a (or can someone imaging a constellation where project makes sense but inject does not? In that case, the two classes should be completely independent instead) Kind regards, Hannah.