id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
1089,Somewhat bad type error message,kirsten,,"{{{
module Small where
import Data.Maybe

filterNothings :: [[Maybe a]] -> [[a]]
filterNothings xs = {- (map catMaybes) -} (filter someFun xs)

someFun = all isJust

-- Compiling the above code gives the following rather bad error message (in ghci 6.6):
{-
Small.hs:5:63:
    Couldn't match expected type `a' (a rigid variable)
	   against inferred type `Maybe a'
      `a' is bound by the type signature for `filterNothings'
	at Small.hs:4:26
      Expected type: [[a]]
      Inferred type: [[Maybe a]]
    In the second argument of `filter', namely `xs'
    In the expression: (filter (const True) xs)
-}
-- My error was leaving out the ""(map catMaybes)"" part, in the comment.
-- I think that the error message shouldn't say anything about rigid variables,
-- or at least, I find that confusing, as well as the fact that the error message
-- mentions [a] -> Bool. The problem is the return type of the application
-- of filter is [[Maybe a]], and the type signature I gave for filterNothings has the
-- return type [[a]]. In an ideal world, the error message would point out that the type
-- [[a]] doesn't match [[Maybe a]], without the additional noise. Indeed, if I change
-- someFun to (const True), I do get the error message I'd like, although it still
-- uses the word ""rigid"", which I find suboptimal.
}}}",bug,closed,lowest,,Compiler (Type checker),6.6,wontfix,,,Unknown/Multiple,Unknown/Multiple,,Unknown,,,,
