Opened 6 years ago

Closed 6 years ago

#5695 closed bug (invalid)

Ghci type inference to [()] -> String, when should be Show a => [a] -> Striing

Reported by: guest Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.0.3
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


GHCi, version 7.0.3 from Haskell Platform 2011.2.0.1

*Main> let test = intercalate ";" . map (\a -> "Id=" ++ show a) :: Show a => [a] -> String

*Main> :t test

test :: [()] -> String

Change History (1)

comment:1 Changed 6 years ago by simonmar

difficulty: Unknown
Resolution: invalid
Status: newclosed

This is working correctly. To get the result you expect, either put the type signature on test itself:

let test = intercalate ";" . map (\a -> "Id=" ++ show a); test :: Show a => [a] -> String

or :set -XNoMonomorphismRestriction. Maybe someday we'll turn off the MR by default.

Note: See TracTickets for help on using tickets.