type-checker regression in GHC HEAD?

Simon Peyton Jones simonpj at microsoft.com
Wed Dec 17 11:02:10 UTC 2014


Ah yes!  A palpable bug thank you.  Fixing..

S

|  -----Original Message-----
|  From: Herbert Valerio Riedel [mailto:hvriedel at gmail.com]
|  Sent: 17 December 2014 10:01
|  To: Simon Peyton Jones
|  Cc: Edward Kmett; Austin Seipp
|  Subject: Re: type-checker regression in GHC HEAD?
|  
|  Hello Simon,
|  
|  ...does that repro-case work for you? shall I create a Trac ticket as
|  well? I consider this one quite critical for this week's GHC 7.10.1
|  RC, if it can't compile `lens` :-/
|  
|  Cheers,
|    hvr
|  
|  On 2014-12-16 at 15:03:49 +0100, Herbert Valerio Riedel wrote:
|  > On 2014-12-16 at 14:33:00 +0100, Simon Peyton Jones wrote:
|  >> No immediate bells.
|  >>
|  >> Is it possible to reproduce it without compiling all lens's zillion
|  >> dependencies?
|  >
|  > it's actually easier to isolate than expected:
|  >
|  >   {-# LANGUAGE UndecidableInstances #-}
|  >
|  >   import Control.Applicative
|  >   import Control.Category
|  >   import Prelude hiding ((.),id)
|  >
|  >   newtype FocusingPlus w k s a = FocusingPlus { unfocusingPlus :: k
|  > (s, w) a }
|  >
|  >   instance Functor (k (s, w)) => Functor (FocusingPlus w k s) where
|  >     fmap f (FocusingPlus as) = FocusingPlus (fmap f as)
|  >
|  >   instance Applicative (k (s, w)) => Applicative (FocusingPlus w k
|  s) where
|  >     pure = FocusingPlus . pure
|  >     FocusingPlus kf <*> FocusingPlus ka = FocusingPlus (kf <*> ka)
|  >
|  >
|  > works with GHC 7.8, fails with GHC HEAD w/
|  >
|  >   repro.hs:13:25:
|  >     Couldn't match type ‘f0’ with ‘k (s, w)’
|  >       ‘f0’ is untouchable inside the constraints () bound by the
|  type signature for pure :: a -> FocusingPlus w k s a at repro.hs:13:3-
|  6
|  >     Expected type: a -> k (s, w) a
|  >       Actual type: a -> f0 a
|  >     Relevant bindings include pure :: a -> FocusingPlus w k s a
|  (bound at repro.hs:13:3)
|  >     In the second argument of ‘(.)’, namely ‘pure’
|  >     In the expression: FocusingPlus . pure
|  >   Failed, modules loaded: none.
|  
|  --
|  "Elegance is not optional" -- Richard O'Keefe


More information about the ghc-devs mailing list