[GHC] #12526: regression in type inference with respect to type families

GHC ghc-devs at haskell.org
Tue Aug 23 13:04:05 UTC 2016


#12526: regression in type inference with respect to type families
-------------------------------------+-------------------------------------
           Reporter:  Lemming        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.0.2
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           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:
-------------------------------------+-------------------------------------
 The following bug is present in ghc-8.0.1.20160725, ghc-8.0.1.20160822
 (ghc-8.0.2) and ghc-8.1.20160819 (ghc-head) and was not there in
 ghc-8.0.1. When compiling the head version of synthesizer-llvm package
 from http://code.haskell.org/synthesizer/llvm/ I get the following error:
 {{{
 src/Synthesizer/LLVM/Server/CausalPacked/Instrument.hs:296:23: error:
     • Couldn't match type ‘Synthesizer.Causal.Class.ProcessOf t0’
                      with ‘CausalP.T (SampleRate Real, ())’
       Expected type: CausalP.T
                        (SampleRate Real, ())
                        (Serial.T
                           (LLVM.Value
                              (LLVM.Vector
                                 (TypeNum.Pos
 Type.Data.Num.Decimal.Digit.Dec4 TypeNum.EndDesc)
                                 Float)),
                         (Serial.Value
                            (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                            Real,
                          VectorValue))
                        (Serial.T
                           (LLVM.Value
                              (LLVM.Vector
                                 (TypeNum.Pos
 Type.Data.Num.Decimal.Digit.Dec4 TypeNum.EndDesc)
                                 Float)))
         Actual type: Synthesizer.Causal.Class.ProcessOf
                        t0
                        (Serial.T
                           (LLVM.Value
                              (LLVM.Vector
                                 (TypeNum.Pos
 Type.Data.Num.Decimal.Digit.Dec4 TypeNum.EndDesc)
                                 Float)),
                         (Serial.Value
                            (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                            Float,
                          Serial.Value
                            (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                            Float))
                        (Serial.T
                           (LLVM.Value
                              (LLVM.Vector
                                 (TypeNum.Pos
 Type.Data.Num.Decimal.Digit.Dec4 TypeNum.EndDesc)
                                 Float)))
       The type variable ‘t0’ is ambiguous
     • In the first argument of ‘($&)’, namely ‘osci’
       In the second argument of ‘liftA2’, namely
         ‘(osci $& shapeCtrl &|& (expo &|& fmap Stereo.left freqs))’
       In the expression:
         liftA2
           Stereo.cons
           (osci $& shapeCtrl &|& (expo &|& fmap Stereo.left freqs))
           (osci $& shapeCtrl &|& (negate expo &|& fmap Stereo.right
 freqs))
     • Relevant bindings include
         osci :: Synthesizer.Causal.Class.ProcessOf
                   t0
                   (Serial.T
                      (LLVM.Value
                         (LLVM.Vector
                            (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                            Float)),
                    (Serial.Value
                       (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                       Float,
                     Serial.Value
                       (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                       Float))
                   (Serial.T
                      (LLVM.Value
                         (LLVM.Vector
                            (TypeNum.Pos Type.Data.Num.Decimal.Digit.Dec4
 TypeNum.EndDesc)
                            Float)))
           (bound at
 src/Synthesizer/LLVM/Server/CausalPacked/Instrument.hs:294:19)
 }}}
 The type for `t0` should be known and then the type checker should be able
 to check that `ProcessOf t0` equals `CausalP.T`. It did so in earlier
 versions but now fails on that part.
 I still have to reduce that example, but for now I want to alert you that
 there seems to be a regression in the type inference.

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


More information about the ghc-tickets mailing list