Opened 8 years ago

Closed 3 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 Revisions:

Description

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 8 years ago by igloo

  • Milestone set to 6.8

comment:2 Changed 8 years ago by simonmar

  • Milestone changed from 6.8 branch to _|_
  • Priority changed from normal to low

comment:3 Changed 7 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:4 Changed 7 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:5 Changed 3 years ago by Yuras

  • Cc shumovichy@… added
  • Type of failure set to 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)
Prelude> 

The ticket seems invalid for me.

comment:6 Changed 3 years ago by simonpj

  • Resolution set to wontfix
  • Status changed from new to closed

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: http://hackage.haskell.org/trac/haskell-prime/wiki/QualifiedOperators

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

Simon

Note: See TracTickets for help on using tickets.