Skip to content

Error messages have the wrong qualified names

This module:

module Foo where

import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as BS
import qualified Data.ByteString.Lazy.Char8 as BSC

check :: ByteString -> Bool
check bs = BS.empty bs

produces this type error:

$ ghci -v0 q.hs

q.hs:9:11:
    Couldn't match expected type `ByteString -> Bool'
           against inferred type `ByteString'
    In the expression: BSC.empty bs
    In the definition of `check': check bs = BSC.empty bs

i.e. it claims that the expression is BSC.empty bs, whereas the program text says BS.empty bs.

Similarly, in this module:

module Foo where

import Data.ByteString.Lazy (ByteString)
import qualified Data.ByteString.Lazy as BS
import Data.ByteString.Lazy.Char8

check :: ByteString -> Bool
check bs = BS.empty bs

the qualifier has disappeared completely in the error message:

$ ghci -v0 q.hs

q.hs:9:11:
    Couldn't match expected type `ByteString -> Bool'
           against inferred type `ByteString'
    In the expression: empty bs
    In the definition of `check': check bs = empty bs
Prelude> 
Trac metadata
Trac field Value
Version 6.11
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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