[GHC] #12936: Type inference regression in GHC HEAD

GHC ghc-devs at haskell.org
Fri Dec 9 13:11:27 UTC 2016


#12936: Type inference regression in GHC HEAD
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Rufflewind):

 Ran into this same bug too.  I think something is broken with the
 constraint solving and/or functional dependencies.  I managed to simplify
 the bug to the following:

 {{{#!hs
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE FlexibleInstances #-}
 {-# LANGUAGE FunctionalDependencies #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE ScopedTypeVariables #-}
 module Token where

 class S s t | s -> t

 m :: forall s t . S s t => s
 m = undefined

 o :: forall s t . S s t => s -> s
 o = undefined

 c :: forall s . s -> s -> s
 c = undefined

 p :: forall s . S s () => s -> s
 p d = f
   where

     -- declaring either of these type signatures will cause the bug to go
 away

     -- f :: s
     f = c d (o e)

     -- e :: s
     e = c m m
 }}}

 Inlining it any further will cause the bug to vanish.

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


More information about the ghc-tickets mailing list