Skip to content

Strange behavior of GHC by writing the types in GHCi

  • A: you type :set +t then you write 1:2, the answer is:\\
Prelude> :set +t
Prelude> 1:2

<interactive>:8:1: error:
    * Non type-variable argument in the constraint: Num [a]
      (Use FlexibleContexts to permit this)
    * When checking the inferred type
        it :: forall a. (Num [a], Num a) => [a]

\\

  • B: you type :t 1:2, the answer is:\\
Prelude> :t 1:2
1:2 :: (Num [a], Num a) => [a]

\\ There is an obvious bug. Don't answer me that this behavior is correct, please! The two answers should be the same. Either answer A or answer B.

Trac metadata
Trac field Value
Version 8.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information