Opened 10 years ago

Closed 4 years ago

#1383 closed feature request (wontfix)

mistaken qualified infix syntax could have a nicer error message

Reported by: Isaac Dupree Owned by:
Priority: low Milestone:
Component: Compiler Version: 6.6.1
Keywords: Cc: shumovichy@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Consider the expression Prelude.(+) ; we get Not in scope: data constructor `Prelude'. Unfortunately this is valid code if the module-referencing name also is the name of an in-scope data constructor. In the common case that it isn't, at least (a cursory inspection doesn't find any such exports in the libraries, e.g. Data.Map doesn't export a data-constructor Map), a message to the effect that infix operators must be qualified like (Prelude.+) instead, would be nice. (hierarchical module names probably make this a little more complicated somehow)

Change History (6)

comment:1 Changed 10 years ago by igloo

Milestone: 6.8

comment:2 Changed 9 years ago by simonmar

Milestone: 6.8 branch_|_
Priority: normallow

comment:3 Changed 8 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 8 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 4 years ago by Yuras

Cc: shumovichy@… added
Type of failure: None/Unknown

It can be pretty valid expression. An example:

Prelude> data Prelude a = Prelude a
Prelude> :t Prelude.(+)
Prelude.(+) :: Num a => a -> Prelude (a -> a)

The ticket seems invalid for me.

comment:6 Changed 4 years ago by simonpj

Resolution: wontfix
Status: newclosed

Yes, in Haskell Prelude.(+) means (Prelude . (+)), that is the composition of the function Prelude and the function (+).

There's a Haskell Prime proposal to change this:

Till then I don't see how we can improve the error message.


Note: See TracTickets for help on using tickets.