[GHC] #10570: Too restrictive liberate coverage condition

GHC ghc-devs at haskell.org
Thu Jun 25 10:32:31 UTC 2015


#10570: Too restrictive liberate coverage condition
-------------------------------------+-------------------------------------
        Reporter:  danilo2           |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.10.1
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by danilo2:

Old description:

> Hello! Let's look at this small example:
>
> {{{haskell
> class ConsByIdx2 x a m cls | x -> m where
>     consByIdx2 :: x -> a -> m cls
>

> instance ConsByIdx2 Int a Proxy cls where
>     consByIdx2 _ _ = Proxy
> }}}
>
> It fails to compile with the following error:
>
> {{{haskell
>     Illegal instance declaration for ‘ConsByIdx2 Int a Proxy cls’
>       The liberal coverage condition fails in class ‘ConsByIdx2’
>         for functional dependency: ‘x -> m’
>       Reason: lhs type ‘Int’ does not determine rhs type ‘Proxy’
>     In the instance declaration for ‘ConsByIdx2 Int a Proxy cls’
> }}}
>
> But Int determines the Proxy in a nice way.

New description:

 Hello! Let's look at this small example:

 {{{
 class ConsByIdx2 x a m cls | x -> m where
     consByIdx2 :: x -> a -> m cls


 instance ConsByIdx2 Int a Proxy cls where
     consByIdx2 _ _ = Proxy
 }}}

 It fails to compile with the following error:

 {{{
     Illegal instance declaration for ‘ConsByIdx2 Int a Proxy cls’
       The liberal coverage condition fails in class ‘ConsByIdx2’
         for functional dependency: ‘x -> m’
       Reason: lhs type ‘Int’ does not determine rhs type ‘Proxy’
     In the instance declaration for ‘ConsByIdx2 Int a Proxy cls’
 }}}

 But Int determines the Proxy in a nice way.

--

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10570#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list