Thank you. I followed your suggestion
and implemented my default Divide as you've shown below.
[EMAIL PROTECTED] wrote:
If we assume that we need Reciprocate
only if we are going to use the
'default' method, the solution becomes obvious. It does involve
overlapping and undecidable instances,
Jeff Harper defined typeclasses
class Reciprocate a b | a - b where
recip :: a - b
class Multiply a b c | a b - c where
(*) :: a - b - c
and encountered the problem with
-- Here I define a default (/) operator that uses the
-- Reciprocate and Multiply class to perform division.
The following message is in a Haskell
module. It will be easier to read in a fixed point font.
{-# OPTIONS -fglasgow-exts #-}
-- Hi,
--
-- I ran into an issue while working
with functional dependencies.
-- Consider the following code. I'm
rewriting many of the prelude
-- operators using
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 08 September 2000 17:17
To: [EMAIL PROTECTED]
Subject: Re: Inferring types
Sat, 9 Sep 2000 00:56:46 +1100, Fergus Henderson
[EMAIL PROTECTED] pisze:
If you define `p' as a syntactic function, e.g
Mon, 11 Sep 2000 08:51:52 +0100, Chris Angus [EMAIL PROTECTED] pisze:
Some people think that the monomorphism restriction should be removed.
(There are no technical problems with this AFAIK.)
I was under the impression that this introduced to increase efficency
(prevents the same
Hi!
I'm intrigued by the following Haskell behaviour:
The type of (+) is
(+) :: (Num a) = a - a - a
Now, if I define
p = (+)
the type of p is inferred to be
p :: Integer - Integer - Integer
How come?
I guess the answer can be found somewhere in the Haskell report, but I'd
really
On 08-Sep-2000, Jan Carlson [EMAIL PROTECTED] wrote:
I'm intrigued by the following Haskell behaviour:
The type of (+) is
(+) :: (Num a) = a - a - a
Now, if I define
p = (+)
the type of p is inferred to be
p :: Integer - Integer - Integer
How come?
I guess the answer can
If you define `p' as a syntactic function, e.g.
p x y = x + y
or
p x = (+) x
rather than via
p = (+)
then the monomorphism restriction does not apply, and so the type inferred
for `p' will be the correct polymorphic type `Num a = a - a - a'.
May I just take
Sat, 9 Sep 2000 00:56:46 +1100, Fergus Henderson [EMAIL PROTECTED] pisze:
If you define `p' as a syntactic function, e.g.
then the monomorphism restriction does not apply, and so the type inferred
for `p' will be the correct polymorphic type `Num a = a - a - a'.
Also when an explicit type