[Haskell-cafe] Inferring types from functional dependencies

2006-06-16 Thread Jeff . Harper
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,

[Haskell-cafe] Re: Inferring types from functional dependencies

2006-06-10 Thread oleg
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.

[Haskell-cafe] Inferring types from functional dependencies

2006-06-09 Thread Jeff . Harper
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

RE: Inferring types

2000-09-11 Thread Chris Angus
-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

Re: Inferring types

2000-09-11 Thread Marcin 'Qrczak' Kowalczyk
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

Inferring types

2000-09-08 Thread Jan Carlson
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

Re: Inferring types

2000-09-08 Thread Fergus Henderson
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

Re: Inferring types

2000-09-08 Thread Jon Fairbairn
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

Re: Inferring types

2000-09-08 Thread Marcin 'Qrczak' Kowalczyk
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