Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Fri, 28 Sep 2012 18:33:23 -0700, Alexander Solla wrote: Only with respect to type inference. I don't understand this comment. I wouldn't have replied with that line of thought if you had just told us what the problem was in the first place. I /was/ saying that you can use explicit type

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 10:30:07 +0200, Francesco Mazzoli wrote: Then I'd also like to have newtype TST sym algo = ... instance (Ord sym, ListLike full sym) = Search (TST sym algo) full algo This one is a different problem - it requires UndecidableInstances and I don't understand

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread MigMit
Well, it seems that you can't do exactly what you want. So, the simplest way to do this would be not to make Foo a superclass for Bar: class Bar a where foo :: Foo a b = a - b - c Then you would have to mention Foo everywhere. If you really need, for some reason, to ensure that every Bar

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 13:04:59 +0400, MigMit wrote: Well, it seems that you can't do exactly what you want. So, the simplest way to do this would be not to make Foo a superclass for Bar: class Bar a where foo :: Foo a b = a - b - c Then you would have to mention Foo everywhere. Just to

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 10:56:29 +0200, Francesco Mazzoli wrote: At Sat, 29 Sep 2012 10:30:07 +0200, Francesco Mazzoli wrote: Then I'd also like to have newtype TST sym algo = ... instance (Ord sym, ListLike full sym) = Search (TST sym algo) full algo This one is a

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Gábor Lehel
On Fri, Sep 28, 2012 at 6:36 PM, Francesco Mazzoli f...@mazzo.li wrote: I would expect this to work, maybe with some additional notation (a la ScopedTypeVariables) {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} class Foo a b | a - b class

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread MigMit
On Sep 29, 2012, at 9:49 PM, Gábor Lehel illiss...@gmail.com wrote: On Fri, Sep 28, 2012 at 6:36 PM, Francesco Mazzoli f...@mazzo.li wrote: I would expect this to work, maybe with some additional notation (a la ScopedTypeVariables) {-# LANGUAGE FunctionalDependencies #-} {-#

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-29 Thread Francesco Mazzoli
At Sat, 29 Sep 2012 19:49:36 +0200, Gábor Lehel wrote: I was browsing the GHC bug tracker and accidentally might have found a solution to your problem: http://hackage.haskell.org/trac/ghc/ticket/7100 Thanks, this makes me feel better. What interested me is not the workarounds, that I had

[Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
I would expect this to work, maybe with some additional notation (a la ScopedTypeVariables) {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE MultiParamTypeClasses #-} class Foo a b | a - b class Foo a b = Bar a where foo :: a - b - c The type family equivalent works

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
CCing the list back. At Fri, 28 Sep 2012 13:30:52 -0700, Alexander Solla wrote: What is the problem, exactly? It looks to me like UndecidableInstances and ScopedTypeVariables (on foo, or its arguments) would be enough. I'm not sure what you mean. I don't see the need for

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Alexander Solla
On Fri, Sep 28, 2012 at 5:04 PM, Francesco Mazzoli f...@mazzo.li wrote: CCing the list back. At Fri, 28 Sep 2012 13:30:52 -0700, Alexander Solla wrote: What is the problem, exactly? It looks to me like UndecidableInstances and ScopedTypeVariables (on foo, or its arguments) would be

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Francesco Mazzoli
At Fri, 28 Sep 2012 17:19:36 -0700, Alexander Solla wrote: Well, then what exactly is the problem? Are you getting an error? ...well yes. The error I get with the posted class declarations is Not in scope: type variable `b' at the line with class Foo a b = Bar a where Which I get

Re: [Haskell-cafe] Class constraints with free type variables and fundeps

2012-09-28 Thread Alexander Solla
On Fri, Sep 28, 2012 at 5:36 PM, Francesco Mazzoli f...@mazzo.li wrote: At Fri, 28 Sep 2012 17:19:36 -0700, Alexander Solla wrote: Well, then what exactly is the problem? Are you getting an error? ...well yes. The error I get with the posted class declarations is Not in scope: type