Skip to content

Type error message pretty-prints unboxed tuples wrongly

I get

PASysDep.hs:51:
    Couldn't match
	`(State# s, MutableByteArray# s)'
	against
	`(State# t, MutableByteArray# t)'
	Expected type: (State# s, MutableByteArray# s)
	Inferred type: (State# t, MutableByteArray# t)
    In the application `newByteArray# (wORD_SCALE n#) s#'
    In the right-hand side of an equation for `newIntArray#':
	newByteArray# (wORD_SCALE n#) s#

where the actual error is that I have used boxed instead of unboxed tuples in a type signature.  In other words, the inferred type should have been reported as

  (# State# t, MutableByteArray# t #)

The code producing this error is as follows:

import PrelByteArr (cHAR_SCALE, wORD_SCALE, fLOAT_SCALE, dOUBLE_SCALE)
import PrelGHC

newIntArray# :: Int# -> State# s -> (State# s, MutableByteArray# s)
newIntArray# n# s# = newByteArray# (wORD_SCALE n#) s#
Trac metadata
Trac field Value
Version None
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution ResolvedFixed
Component Compiler (Type checker)
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