logo       

Re: [GHC] #472: Supertyping of classes: msg#00188

lang.haskell.glasgow.bugs

Subject: Re: [GHC] #472: Supertyping of classes

#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_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise