Skip to content

Supertyping of classes

see Supertyping Suggestion for Haskell

example:

class Num a <= Group a where
	(+) :: a -> a -> a 
	negate :: a -> a

apart from multiple inheritance, it could work like this:

import Prelude hiding ((+),negate)
import qualified Prelude ((+),negate)

class Group a where
	(+) :: a -> a -> a 
	negate :: a -> a

instance Num a => Group a where
	(+) = (Prelude.+)
	negate = Prelude.negate
  • coeus_at_gmx_de
Edited by Ian Lynagh -
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information