[GHC] #15172: Undecidable instances slip through

GHC ghc-devs at haskell.org
Mon May 21 10:34:22 UTC 2018


#15172: Undecidable instances slip through
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.6.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Description changed by simonpj:

Old description:

> Consider
> {{{
> {-# LANGUAGE FlexibleInstances, TypeFamilies, ConstraintKinds #-}
>
> type family F a :: Constraint
>
> class C a where
> instance (F a) => C [[a]] where
> }}}
> This should be rejected because the `F a` constraint could expand to be
> arbitrarily large, depending on `F`.  There's simply a missing check in
> `checkInstTermination`.

New description:

 Consider
 {{{
 {-# LANGUAGE FlexibleInstances, TypeFamilies, ConstraintKinds #-}

 type family F a :: Constraint

 class C a where
 instance (F a) => C [[a]] where
 }}}
 This should be rejected because the `F a` constraint could expand to be
 arbitrarily large, depending on `F`.

 But it's accepted by HEAD.  There's simply a missing check in
 `checkInstTermination`.

--

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


More information about the ghc-tickets mailing list