regression in type inference with respect to type families
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |