I want to use functional dependencies in a way I've not yet seen: to enforce
commutativity.
I define
class Mul a b c | a b -> c, b a -> c where mul :: a -> b -> c
I want
instance (Mul a b c) => Mul b a c where mul x y = mul y x
do what I expect: if I can multiply a and b, then I can multiply
Hello,
I am currently toying with the idea of implementing a PostScript
library in Haskell, and I am currently implementing a static,
simplified version of the Postscript type checker using phantom types
and functional dependencies. I am enriching the Postscript definitions
with types so that
There seems to be a mismatch between hugs and ghc.
hugs -98
:version
-- Hugs Version February 2001
accepts the following:
== EqList.hs
module EqList where
data Nil = Nil
data Cons x xs = Cons x xs
class EqList a b c | a b -> c where
comp :: a -> b -> c
comp _ _ = error
At 2002-12-14 15:27, [EMAIL PROTECTED] wrote:
>I define
>
>class Mul a b c | a b -> c, b a -> c where mul :: a -> b -> c
The two constraints are identical. Each one says "given a and b, you have
c".
What you want is essentially this:
class (Mul b a c) => Mul a b c where
mul :: a -> b ->
Hi,
I spent about a half hour toying around with this and came up with the
following, which seems to work (in ghci, but not hugs -- question for
smart people: which is correct, if either?)...
class Mul a b c | a b -> c where
mul :: a -> b -> c-- our standard multiplication, with fundeps
d
In article <[EMAIL PROTECTED]>,
Hal Daume III <[EMAIL PROTECTED]> wrote:
> I spent about a half hour toying around with this and came up with the
> following, which seems to work (in ghci, but not hugs -- question for
> smart people: which is correct, if either?)...
Both are correct. Hugs fails
On Monday 16 December 2002 18:18, Ashley Yakeley wrote:
> In article <[EMAIL PROTECTED]>,
>
> Hal Daume III <[EMAIL PROTECTED]> wrote:
> > I spent about a half hour toying around with this and came up with the
> > following, which seems to work (in ghci, but not hugs -- question for
> > smart peop