RE: Fundeps and type equality

2013-01-11 Thread Simon Peyton-Jones
...@haskell.org; Simon Peyton-Jones; GHC Users Mailing List Subject: Re: Fundeps and type equality Yes, I finished and pushed in December. A description of the design and how to use the feature is here: http://hackage.haskell.org/trac/ghc/wiki/NewAxioms There's also a section (7.7.2.2 to be exact

Re: Fundeps and type equality

2013-01-11 Thread Richard Eisenberg
; Simon Peyton-Jones; GHC Users Mailing List Subject: Re: Fundeps and type equality Yes, I finished and pushed in December. A description of the design and how to use the feature is here: http://hackage.haskell.org/trac/ghc/wiki/NewAxioms There's also a section (7.7.2.2 to be exact

RE: Class instance specificity order (was Re: Fundeps and type equality)

2013-01-11 Thread Simon Peyton-Jones
| The -XOverlappingInstances flag instructs GHC to allow more than one | instance to match, provided there is a most specific one. For example, | the constraint C Int [Int] matches instances (A), (C) and (D), but the | last is more specific, and hence is chosen. If there is no most-specific |

Re: Fundeps and type equality

2013-01-11 Thread Carter Schonwald
Of *Iavor Diatchki *Sent:* 26 December 2012 02:48 *To:* Conal Elliott *Cc:* glasgow-haskell-b...@haskell.org; GHC Users Mailing List *Subject:* Re: Fundeps and type equality ** ** Hello Conal, ** ** GHC implementation of functional dependencies is incomplete: it will use functional

Re: Fundeps and type equality

2013-01-11 Thread Richard Eisenberg
2012 02:48 To: Conal Elliott Cc: glasgow-haskell-b...@haskell.org; GHC Users Mailing List Subject: Re: Fundeps and type equality Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine

Re: Class instance specificity order (was Re: Fundeps and type equality)

2013-01-11 Thread Tyson Whitehead
On January 11, 2013 13:55:58 Simon Peyton-Jones wrote: | The -XOverlappingInstances flag instructs GHC to allow more than one | instance to match, provided there is a most specific one. For example, | the constraint C Int [Int] matches instances (A), (C) and (D), but the | last is more

Re: Fundeps and type equality

2013-01-11 Thread Carter Schonwald
*To:* Conal Elliott *Cc:* glasgow-haskell-b...@haskell.org; GHC Users Mailing List *Subject:* Re: Fundeps and type equality ** ** Hello Conal, ** ** GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e

Re: Fundeps and type equality

2013-01-10 Thread Richard Eisenberg
: 26 December 2012 02:48 To: Conal Elliott Cc: glasgow-haskell-b...@haskell.org; GHC Users Mailing List Subject: Re: Fundeps and type equality Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e

Re: Fundeps and type equality

2013-01-10 Thread Carter Schonwald
:* glasgow-haskell-b...@haskell.org; GHC Users Mailing List *Subject:* Re: Fundeps and type equality ** ** Hello Conal, ** ** GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine the values of free type

Class instance specificity order (was Re: Fundeps and type equality)

2013-01-10 Thread Tyson Whitehead
On January 10, 2013 13:56:02 Richard Eisenberg wrote: Class instances that overlap are chosen among by order of specificity; Sorry to jump in the middle here, but this caught my attention as this sort of specificity determination is exactly what I had in mind when I was working on my The shape

RE: Class instance specificity order (was Re: Fundeps and type equality)

2013-01-10 Thread Simon Peyton-Jones
-haskell-users@haskell.org | Cc: Richard Eisenberg; Martin Sulzmann; Simon Peyton-Jones | Subject: Class instance specificity order (was Re: Fundeps and type equality) | | On January 10, 2013 13:56:02 Richard Eisenberg wrote: | Class instances that overlap are chosen among by order of specificity

RE: Class instance specificity order (was Re: Fundeps and type equality)

2013-01-10 Thread Tyson Whitehead
On Thu, 2013-01-10 at 22:17 +, Simon Peyton-Jones wrote: Is http://www.haskell.org/ghc/docs/latest/html/users_guide/type-class-extensions.html#instance-overlap insufficiently clear? If so, let's clarify it. Thanks for getting back to me Simon. The document says For example, consider

Re: Fundeps and type equality

2013-01-10 Thread Richard Eisenberg
December 2012 02:48 To: Conal Elliott Cc: glasgow-haskell-b...@haskell.org; GHC Users Mailing List Subject: Re: Fundeps and type equality Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e

Re: Fundeps and type equality

2013-01-10 Thread Martin Sulzmann
...@haskell.org] *On Behalf Of *Iavor Diatchki *Sent:* 26 December 2012 02:48 *To:* Conal Elliott *Cc:* glasgow-haskell-b...@haskell.org; GHC Users Mailing List *Subject:* Re: Fundeps and type equality ** ** Hello Conal, ** ** GHC implementation of functional dependencies

RE: Fundeps and type equality

2013-01-02 Thread Simon Peyton-Jones
: 26 December 2012 02:48 To: Conal Elliott Cc: glasgow-haskell-bugs@haskell.org; GHC Users Mailing List Subject: Re: Fundeps and type equality Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine

RE: Fundeps and type equality

2013-01-02 Thread Simon Peyton-Jones
: 26 December 2012 02:48 To: Conal Elliott Cc: glasgow-haskell-b...@haskell.org; GHC Users Mailing List Subject: Re: Fundeps and type equality Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine

Re: Fundeps and type equality

2013-01-02 Thread Martin Sulzmann
-haskell-bugs-boun...@haskell.org] *On Behalf Of *Iavor Diatchki *Sent:* 26 December 2012 02:48 *To:* Conal Elliott *Cc:* glasgow-haskell-b...@haskell.org; GHC Users Mailing List *Subject:* Re: Fundeps and type equality ** ** Hello Conal, ** ** GHC implementation of functional

Re: Fundeps and type equality

2012-12-26 Thread Conal Elliott
Hi Iavor, Thanks much for the explanation. Before this experiment with FDs, I was using a type family. I tried switching to FDs, because I wanted the compiler to know that the family is injective in order to assist type-checking. Can we declare type families to be injective? Now I see that I ran

Re: Fundeps and type equality

2012-12-26 Thread Conal Elliott
Hi Iavor, Thanks much for the explanation. Before this experiment with FDs, I was using a type family. I tried switching to FDs, because I wanted the compiler to know that the family is injective in order to assist type-checking. Can we declare type families to be injective? Now I see that I ran

Re: Fundeps and type equality

2012-12-26 Thread Roman Cheplyaka
I presume that injectivity of type families is the sole reason why data families exist. Roman * Conal Elliott co...@conal.net [2012-12-26 10:23:46-0800] Hi Iavor, Thanks much for the explanation. Before this experiment with FDs, I was using a type family. I tried switching to FDs,

Re: Fundeps and type equality

2012-12-26 Thread Brent Yorgey
I don't think that's true (though a few minutes of searching has not yet turned up anything describing the original motivation for data families). Sometimes you really do want to construct a family of new data types, instead of just mapping to existing ones. I think everyone agrees that using

Re: Fundeps and type equality

2012-12-26 Thread Roman Cheplyaka
* Brent Yorgey byor...@seas.upenn.edu [2012-12-26 14:49:16-0500] I don't think that's true (though a few minutes of searching has not yet turned up anything describing the original motivation for data families). Sometimes you really do want to construct a family of new data types, instead of

Re: Fundeps and type equality

2012-12-25 Thread Iavor Diatchki
Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine the values of free type variables), but it will not use them in proofs, which is what is needed in examples like the one you posted. The reason

Re: Fundeps and type equality

2012-12-25 Thread Iavor Diatchki
Hello Conal, GHC implementation of functional dependencies is incomplete: it will use functional dependencies during type inference (i.e., to determine the values of free type variables), but it will not use them in proofs, which is what is needed in examples like the one you posted. The reason

RE: fundeps help

2007-12-04 Thread Simon Peyton-Jones
| And here we know that y=Bool; yet since we don't write the type sig | directly we can't say it. So GHC's implementation of fundeps rejects | this program; again it can't be translated into System F. | | Conveniently, this is a good example of my other problem with fundeps :-) | I can work

RE: fundeps help

2007-12-04 Thread Sittampalam, Ganesh
I think that if you use the HEAD, much of this will work, if you use the type-equality notation. But you will probably encounter bugs too. And in so doing, and reporting them, you'll be doing us a service. I did originally intend to try all this with the HEAD, but one obstacle to this is

RE: fundeps help

2007-12-04 Thread Simon Peyton-Jones
| I did originally intend to try all this with the | HEAD, but one obstacle to this is the lack of recent linux | binaries in http://www.haskell.org/ghc/dist/current/dist/ Ian is fixing that. We'd missed the fact that the bindists weren't being built. Hold on a day or two. Simon

RE: fundeps help

2007-12-03 Thread Simon Peyton-Jones
| I'm trying to understand what fundeps do and don't let me do. One | particular source of confusion is why the following program doesn't | typecheck: | | {-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies #-} | module Fundeps where | | class Dep a b | a - b, b - a | | conv :: (Dep a

Re: fundeps help

2007-12-03 Thread Jan-Willem Maessen
On Dec 3, 2007, at 4:02 AM, Simon Peyton-Jones wrote: GHC's new intermediate language, System FC, is specifically designed to do this. Currently we're in transition: equality constraints are starting to work, but fundeps are implemented as they always were. I hope we can eventually

RE: fundeps help

2007-12-03 Thread Simon Peyton-Jones
| Is it really a good idea to permit a type signature to include | equality constraints among unifiable types? Does the above type | signature mean something different from a -a? Does the type signature: | foo :: (a~Bar b) = a - Bar b | mean something different from: | foo :: Bar b -

Re: fundeps help

2007-12-03 Thread Ganesh Sittampalam
On Mon, 3 Dec 2007, Simon Peyton-Jones wrote: No, you didn't miss anything. I wouldn't expect anyone to write these types directly. But it can happen: class C a b | a-b instance C Int Bool class D x where op :: forall y. C x y = x - y instance D Int

Re: fundeps help

2007-12-03 Thread Manuel M T Chakravarty
Jan-Willem Maessen: Is it really a good idea to permit a type signature to include equality constraints among unifiable types? Does the above type signature mean something different from a -a? Does the type signature: foo :: (a~Bar b) = a - Bar b mean something different from: foo

[Haskell-cafe] Re: Fundeps: I feel dumb

2006-04-13 Thread Creighton Hogg
On 13 Apr 2006 03:27:03 -, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Creighton Hogg wrote: No instance for (MatrixProduct a (Vec b) c) arising from use of `*' at interactive:1:3-5 Probable fix: add an instance declaration for (MatrixProduct a (Vec b) c) In

[Haskell-cafe] Re: Fundeps: I feel dumb

2006-04-12 Thread oleg
Creighton Hogg wrote: No instance for (MatrixProduct a (Vec b) c) arising from use of `*' at interactive:1:3-5 Probable fix: add an instance declaration for (MatrixProduct a (Vec b) c) In the definition of `it': it = 10 * (vector 10 ([0 .. 9])) Let us look at the

Re: fundeps syntax is ugly

2006-02-02 Thread Bulat Ziganshin
Hello Johannes, Thursday, February 02, 2006, 2:17:42 PM, you wrote: JW When I first learned functional dependencies JW I remember I was really confused by their syntax. JW First, it is hard to find it defined: i should wrote this earlier, but nevertheless: Hugs documentation contains

Re: fundeps for extended Monad definition

2003-03-05 Thread Ashley Yakeley
In article [EMAIL PROTECTED] ft.com, Simon Peyton-Jones [EMAIL PROTECTED] wrote: Here's a less complicated variant of the same problem: class C a b | a - b where {} instance C Int Int where {} f :: (C Int b) = Int - b f x = x Is the defn of f legal? Both

Re: fundeps for extended Monad definition

2003-03-05 Thread oleg
Ashley Yakeley wrote: If this were allowed, it would effectively allow type-lambda class C a b | a - b instance C Int Bool instance C Bool Char newtype T a = MkT (forall b.(C a b) = b) helperIn :: (forall b.(C a b) = b) - T a helperIn b = MkT b; -- currently won't work helperOut :: T a

RE: fundeps for extended Monad definition

2003-03-04 Thread Simon Peyton-Jones
| I believe something along the lines of the following would work: | | class C a b | a - b where { foo :: b - String } | instance C Int Int where { foo x = show (x+1) } | x :: forall b. C Int b = b | x = 5 | | (Supposing that the above definition were valid; i.e., we didn't get the | type

RE: fundeps for extended Monad definition

2003-03-03 Thread Simon Peyton-Jones
| The reason, which is thoroughly explained in Simon Peyton-Jones' | message, is that the given type signature is wrong: it should read | f1 :: (exists b. (C Int b) = Int - b) | | Right. Simon pointed out that this is a pretty useless function, but not | entirely so, since the result of

RE: fundeps for extended Monad definition

2003-03-03 Thread Hal Daume III
| entirely so, since the result of it is not of type 'forall b. b', but | rather of 'forall b. C Int b = b'. Thus, if the C class has a function | which takes a 'b' as an argument, then this value does have use. I disagree. Can you give an example of its use? I believe something

RE: fundeps for extended Monad definition

2003-03-03 Thread oleg
| The reason, which is thoroughly explained in Simon Peyton-Jones' | message, is that the given type signature is wrong: it should read | f1 :: (exists b. (C Int b) = Int - b) Can you give an example of its use? Yes, I can. class (Show a, Show b) = C a b | a - b where doit:: a -

RE: fundeps known beforehand (was RE: fundeps for extended Monad definition)

2003-02-28 Thread Simon Peyton-Jones
| since this claims that it will take a Bool and produce a value of type b | for all types b. However, would it be all right to say (in | pseudo-Haskell): | | f :: exists b . Bool - b | f x = x But this is a singularly useless function, because it produces a result of utterly unknown type, so

RE: fundeps for extended Monad definition

2003-02-28 Thread Hal Daume III
The reason, which is thoroughly explained in Simon Peyton-Jones' message, is that the given type signature is wrong: it should read f1 :: (exists b. (C Int b) = Int - b) Right. Simon pointed out that this is a pretty useless function, but not entirely so, since the result of it is not

RE: fundeps for extended Monad definition

2003-02-28 Thread oleg
Hello! It seems we can truly implement Monad2 without pushing the envelope too far. The solution and a few tests are given below. In contrast to the previous approach, here we lift the type variables rather than bury them. The principle is to bring the type logic programming at the level

RE: fundeps for extended Monad definition

2003-02-27 Thread Simon Peyton-Jones
Interesting example | class Monad2 m a ma | m a - ma, ma - m a where | return2 :: a - ma | bind2 :: Monad2 m b mb = ma - (a - mb) - mb | _unused :: m a - () | _unused = \_ - () | instance Monad2 [] a [a] where | bind2 = error urk The functional dependencies say m a -

fundeps known beforehand (was RE: fundeps for extended Monad definition)

2003-02-27 Thread Hal Daume III
Hi Simon, all, Here's a less complicated variant of the same problem: class C a b | a - b where {} instance C Int Int where {} f :: (C Int b) = Int - b f x = x This is interesting, but I'm not entirely sure what the problem is (from a theoretical, not

RE: fundeps for extended Monad definition

2003-02-27 Thread oleg
Hello! Simon Peyton-Jones wrote: class C a b | a - b where {} instance C Int Int where {} f1 :: (forall b. (C Int b) = Int - b) f1 x = undefined Indeed, this gives an error message Cannot unify the type-signature variable `b' with the type `Int' Expected type: Int

Re: fundeps known beforehand (was RE: fundeps for extended Monad definition)

2003-02-27 Thread Hal Daume III
Suppose we are in case 1. Then the programmer has written a too-general type signature on f. The programmer *must* know that b=Int in this case otherwise his function definition makes no sense. However, I don't really see a reason why this should be an error rather than just a warning. If

RE: fundeps for extended Monad definition

2003-02-27 Thread Hal Daume III
The reason, which is thoroughly explained in Simon Peyton-Jones' message, is that the given type signature is wrong: it should read f1 :: (exists b. (C Int b) = Int - b) Sigh, read this after posting :) ___ Haskell mailing list [EMAIL

Re: fundeps question

2002-12-17 Thread Jeffrey R Lewis
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 people: which is

Re: fundeps question

2002-12-16 Thread Hal Daume III
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

Re: fundeps question

2002-12-16 Thread Ashley Yakeley
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

Re: fundeps question

2002-12-15 Thread Ashley Yakeley
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 - c mul a

Re: Fundeps and quantified constructors

2001-02-08 Thread anatoli
--- Tom Pledger [EMAIL PROTECTED] wrote: anatoli writes: : | The same error message is given for | | data Foo a = (Eq b) = MkFoo b Since the type variable a is orphaned, how about reducing it to this? data Foo = forall b . Eq b = MkFoo b This is possible (the semantics is

Re: Fundeps and quantified constructors

2001-02-07 Thread anatoli
Hi everybody: I think I've found what's the problem. Still no solution in sight :( The problem has nothing to do with fundeps. Consider an example: data Foo a = (Eq a) = MkFoo a This gives the same error message: type variable a is not locally bound. Apparently, 'a' in 'Eq a' hides 'a' in

RE: Fundeps

2000-06-25 Thread Mark P Jones
Hi Marcin, | module M where | | class Seq s a | s - a where | m :: Seq s b = (a - b) - s a - s b This combination of constructor classes and functional dependencies looks very odd! The dependency says that, if you pick a particular implementation s of sequences, then there will be at most