[GHC] #472: Supertyping of classes
GHC
trac at galois.com
Fri Oct 20 10:37:09 EDT 2006
#472: Supertyping of classes
-------------------------------------+--------------------------------------
Reporter: nobody | Owner: nobody
Type: feature request | Status: assigned
Priority: normal | Milestone: _|_
Component: Compiler (Type checker) | Version: None
Severity: minor | Resolution: None
Keywords: | Difficulty: Unknown
Testcase: N/A | Architecture: Unknown
Os: Unknown |
-------------------------------------+--------------------------------------
Changes (by igloo):
* architecture: => Unknown
* difficulty: => Unknown
* component: None => Compiler (Type checker)
* milestone: => _|_
* testcase: => N/A
* os: => Unknown
Old description:
> {{{
> see "Supertyping Suggestion for Haskell"
> [url]http://repetae.net/john/recent/out/supertyping.html[/url]
>
> example:
> [code]
> class Num a <= Group a where
> (+) :: a -> a -> a
> negate :: a -> a
> [/code]
>
> apart from multiple inheritance, it could work like this:
>
> [code]
> 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
> [/code]
>
> - coeus_at_gmx_de
>
> }}}
New description:
see
[http://repetae.net/john/recent/out/supertyping.html 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
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/472>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list