Opened 2 years ago

Closed 2 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 Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

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 2 years ago by simonmar

  • Difficulty set to Unknown
  • Resolution set to invalid
  • Status changed from new to closed

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.