
Hi all, say I want to instantiate class Dep (a :: k) b | a -> b as instance Dep x y => Dep (Just x) (Maybe y) Is this supposed to work? I get "The coverage condition fails" errors. For simple cases like instance Dep True Bool etc. it seems to work fine. Thanks and cheers, Gabor

Let's rewrite with explicit kind variables, noting that b is also poly-kinded:
class Dep k k2 (a :: k) (b :: k2) | a -> b k2
-- if a determines b, it surely determines k2
instance Dep k * x y => Dep (Maybe k) * (Just x) (Maybe y)
Actually, even with the kinds explicit, it still looks valid to me. Post a bug report?
Richard
On Jul 31, 2015, at 9:54 AM, Gabor Greif
Hi all,
say I want to instantiate
class Dep (a :: k) b | a -> b
as
instance Dep x y => Dep (Just x) (Maybe y)
Is this supposed to work? I get "The coverage condition fails" errors.
For simple cases like
instance Dep True Bool
etc. it seems to work fine.
Thanks and cheers,
Gabor _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

you need "liberal coverage checking", so UndecidableInstances. Are you doing that?
| -----Original Message-----
| From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of
| Richard Eisenberg
| Sent: 31 July 2015 16:10
| To: Gabor Greif
| Cc: ghc-devs
| Subject: Re: Fundep question
|
| Let's rewrite with explicit kind variables, noting that b is also
| poly-kinded:
|
| class Dep k k2 (a :: k) (b :: k2) | a -> b k2
| -- if a determines b, it surely determines k2
|
| instance Dep k * x y => Dep (Maybe k) * (Just x) (Maybe y)
|
| Actually, even with the kinds explicit, it still looks valid to me.
| Post a bug report?
|
| Richard
|
| On Jul 31, 2015, at 9:54 AM, Gabor Greif

No. I'll switch that on and report back. Thanks, Gabor Em sexta-feira, 31 de julho de 2015, Simon Peyton Jones < simonpj@microsoft.com> escreveu:
you need "liberal coverage checking", so UndecidableInstances. Are you doing that?
| -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org javascript:;] On Behalf Of | Richard Eisenberg | Sent: 31 July 2015 16:10 | To: Gabor Greif | Cc: ghc-devs | Subject: Re: Fundep question | | Let's rewrite with explicit kind variables, noting that b is also | poly-kinded: | | class Dep k k2 (a :: k) (b :: k2) | a -> b k2 | -- if a determines b, it surely determines k2 | | instance Dep k * x y => Dep (Maybe k) * (Just x) (Maybe y) | | Actually, even with the kinds explicit, it still looks valid to me. | Post a bug report? | | Richard | | On Jul 31, 2015, at 9:54 AM, Gabor Greif
javascript:;> wrote: | | > Hi all, | > | > say I want to instantiate | > | > class Dep (a :: k) b | a -> b | > | > as | > | > instance Dep x y => Dep (Just x) (Maybe y) | > | > Is this supposed to work? I get "The coverage condition fails" | errors. | > | > For simple cases like | > | > instance Dep True Bool | > | > etc. it seems to work fine. | > | > Thanks and cheers, | > | > Gabor | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs@haskell.org javascript:; | > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs | | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org javascript:; | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Yeah, this should work with UndecidableInstances. The reason you need that
extension is that if we consider the context, then there are some
pathological examples that can make GHC's instance checking algorithm go
forever.
On Fri, Jul 31, 2015 at 9:56 AM, Gabor Greif
No. I'll switch that on and report back.
Thanks,
Gabor
Em sexta-feira, 31 de julho de 2015, Simon Peyton Jones < simonpj@microsoft.com> escreveu:
you need "liberal coverage checking", so UndecidableInstances. Are you doing that?
| -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of | Richard Eisenberg | Sent: 31 July 2015 16:10 | To: Gabor Greif | Cc: ghc-devs | Subject: Re: Fundep question | | Let's rewrite with explicit kind variables, noting that b is also | poly-kinded: | | class Dep k k2 (a :: k) (b :: k2) | a -> b k2 | -- if a determines b, it surely determines k2 | | instance Dep k * x y => Dep (Maybe k) * (Just x) (Maybe y) | | Actually, even with the kinds explicit, it still looks valid to me. | Post a bug report? | | Richard | | On Jul 31, 2015, at 9:54 AM, Gabor Greif
wrote: | | > Hi all, | > | > say I want to instantiate | > | > class Dep (a :: k) b | a -> b | > | > as | > | > instance Dep x y => Dep (Just x) (Maybe y) | > | > Is this supposed to work? I get "The coverage condition fails" | errors. | > | > For simple cases like | > | > instance Dep True Bool | > | > etc. it seems to work fine. | > | > Thanks and cheers, | > | > Gabor | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs@haskell.org | > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs | | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

With *UndecidableInstances* switchd on it seems to work :-)
Thanks for the help!
Gabor
Em sexta-feira, 31 de julho de 2015, Gabor Greif
No. I'll switch that on and report back.
Thanks,
Gabor
Em sexta-feira, 31 de julho de 2015, Simon Peyton Jones < simonpj@microsoft.com javascript:_e(%7B%7D,'cvml','simonpj@microsoft.com');> escreveu:
you need "liberal coverage checking", so UndecidableInstances. Are you doing that?
| -----Original Message----- | From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of | Richard Eisenberg | Sent: 31 July 2015 16:10 | To: Gabor Greif | Cc: ghc-devs | Subject: Re: Fundep question | | Let's rewrite with explicit kind variables, noting that b is also | poly-kinded: | | class Dep k k2 (a :: k) (b :: k2) | a -> b k2 | -- if a determines b, it surely determines k2 | | instance Dep k * x y => Dep (Maybe k) * (Just x) (Maybe y) | | Actually, even with the kinds explicit, it still looks valid to me. | Post a bug report? | | Richard | | On Jul 31, 2015, at 9:54 AM, Gabor Greif
wrote: | | > Hi all, | > | > say I want to instantiate | > | > class Dep (a :: k) b | a -> b | > | > as | > | > instance Dep x y => Dep (Just x) (Maybe y) | > | > Is this supposed to work? I get "The coverage condition fails" | errors. | > | > For simple cases like | > | > instance Dep True Bool | > | > etc. it seems to work fine. | > | > Thanks and cheers, | > | > Gabor | > _______________________________________________ | > ghc-devs mailing list | > ghc-devs@haskell.org | > http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs | | _______________________________________________ | ghc-devs mailing list | ghc-devs@haskell.org | http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (4)
-
Gabor Greif
-
Iavor Diatchki
-
Richard Eisenberg
-
Simon Peyton Jones