Re: Functional dependencies can "return" kinds, type families cannot

2014-02-13 Thread Richard Eisenberg
On Feb 13, 2014, at 4:28 AM, José Pedro Magalhães wrote: > > The most interesting part here is the functional dependency fs -> k, where k > is a kind variable! > If this is not a bug (and it does seem to work as I expect it to), then could > we have type families > return kinds too?... Yes,

Re: Functional Dependencies

2005-08-19 Thread Dirk Reckmann
Am Mittwoch, 17. August 2005 10:52 schrieb Simon Peyton-Jones: > >From the instance declaration > > instance Fib Zero (Succ Zero) > we get the improvement rule > Fib Zero a ==> a=(Succ Zero) > We get a similar rule from > instance Fib (Succ Zero) (Succ Zero) > But the instance dec

Re: Functional Dependencies

2005-08-17 Thread Dirk Reckmann
Am Dienstag, 16. August 2005 21:17 schrieb Keean Schupke: > Attached are 3 Haskell modules used for type level programming. These Thank you! > The general 'trick' if you will is to imlement each funtion as a type > class, pattern matching the > types to instances in a type-level analogue of the v

Re: Functional Dependencies

2005-08-17 Thread Dirk Reckmann
Am Dienstag, 16. August 2005 19:45 schrieb Iavor Diatchki: > Hello, > I am not sure what GHC is doing, it certainly seems to be > inconsistent. In Hugs both the examples work. In case you are > interested, here is how you can get a version that works in > both Hugs and GHC (I just modified your c

RE: Functional Dependencies

2005-08-17 Thread Simon Peyton-Jones
| > class C a b | a -> b | > instance C Int Bool | > | > f :: forall a. C Int a => a -> a | > f x = x | > | > GHC rejects the type signature for f, because we can see that 'a' *must | > be* Bool, so it's a bit misleading to universally quantify it. | | Ok, maybe this is a reasonabl

Re: Functional Dependencies

2005-08-16 Thread Keean Schupke
Attached are 3 Haskell modules used for type level programming. These were developed as background work for the HList paper, but are not in the final libraries as they are 'off topic' as it were. They were however useful in testing type-level programming concepts. Control.hs - This contains ty

Re: Functional Dependencies

2005-08-16 Thread Iavor Diatchki
Hello, I am not sure what GHC is doing, it certainly seems to be inconsistent. In Hugs both the examples work. In case you are interested, here is how you can get a version that works in both Hugs and GHC (I just modified your code a little): {-# OPTIONS -fglasgow-exts -fallow-undecidable-instan

Re: Functional Dependencies

2005-08-16 Thread Dirk Reckmann
Hello Keean! Am Dienstag, 16. August 2005 13:48 schrieb Keean Schupke: > Picked up on this late... I have working examples of add etc under > ghc/ghci... > I can't remeber all the issues involved in getting it working, but I can > post the > code for add if its any use? Yes, that would be nice. I

Re: Functional Dependencies

2005-08-16 Thread Keean Schupke
Picked up on this late... I have working examples of add etc under ghc/ghci... I can't remeber all the issues involved in getting it working, but I can post the code for add if its any use? Keean. Dirk Reckmann wrote: Am Donnerstag, 11. August 2005 11:41 schrieb Simon Peyton-Jones: Yo

Re: Functional Dependencies

2005-08-15 Thread Dirk Reckmann
Am Donnerstag, 11. August 2005 11:41 schrieb Simon Peyton-Jones: > You raise a vexed question, which has been discussed a lot. Should this > typecheck? > > class C a b | a -> b > instance C Int Bool > > f :: forall a. C Int a => a -> a > f x = x > > GHC rejects the type sig

RE: Functional Dependencies

2005-08-11 Thread Simon Peyton-Jones
You raise a vexed question, which has been discussed a lot. Should this typecheck? class C a b | a -> b instance C Int Bool f :: forall a. C Int a => a -> a f x = x GHC rejects the type signature for f, because we can see that 'a' *must be* Bool, so it's a bit m

Re: Functional dependencies, principal types, and decidable typechecking

2005-04-06 Thread Keean Schupke
Manuel M T Chakravarty wrote: I accept that this is the process by which GHC computes these types, but it does violate the principal types property, doesn't it? The relation Int -> () <= forall c. Int -> c does not hold. I realise that principal types and principal typings are slightly di

RE: Functional dependencies, principal types, and decidable typechecking

2005-04-05 Thread Manuel M T Chakravarty
Simon Peyton-Jones wrote: > | > {-# OPTIONS -fglasgow-exts #-} > | > > | > class C a b c | a b -> c where > | > foo :: (a, b) -> c > | > > | > instance C a a r => C a (b, c) r where > | > foo (a, (b, c)) = foo (a, a) > > You are already on dodgy ground here, because the instance decl doesn't >

RE: Functional dependencies, principal types, and decidable typechecking

2005-04-05 Thread Simon Peyton-Jones
Manuel Your short program tickles a lot of different questions. Here's an explanation. Simon | Assume the following type class declarations with functional | dependencies: Actually much of the behaviour you see happens without fundeps. | > {-# OPTIONS -fglasgow-exts #-} | > | > class C a b c

Re: Functional dependencies, principal types, and decidable type checking

2005-04-05 Thread Manuel M T Chakravarty
Iavor Diatchki wrote: > Hi, > > On Apr 3, 2005 7:33 AM, Manuel M T Chakravarty <[EMAIL PROTECTED]> wrote: > > Assume the following type class declarations with functional > > dependencies: > > > > > {-# OPTIONS -fglasgow-exts #-} > > > > > > class C a b c | a b -> c where > > > foo :: (a, b) ->

Re: Functional dependencies, principal types, and decidable type checking

2005-04-03 Thread Iavor Diatchki
Hi, On Apr 3, 2005 7:33 AM, Manuel M T Chakravarty <[EMAIL PROTECTED]> wrote: > Assume the following type class declarations with functional > dependencies: > > > {-# OPTIONS -fglasgow-exts #-} > > > > class C a b c | a b -> c where > > foo :: (a, b) -> c > > > > instance C a a r => C a (b, c) r

RE: functional dependencies - bug?

2002-07-01 Thread Simon Peyton-Jones
Christian This is clearly a bug in 5.03. However, it works fine in the (about to be released) 5.04. My plan, therefore, is to add it to our regression test suite and delcare victory. If I was being totally thorough I'd find out what went wrong in 5.03, in case it's still wrong in 5.04, but