Opened 11 years ago

Closed 6 years ago

#1930 closed feature request (fixed)

Make operators into type constructors, rather than type variables

Reported by: igloo Owned by:
Priority: normal Milestone:
Component: Compiler Version: 6.8.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: ghci/scripts/ghci033
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


The + a b here should be either (+) a b or a + b:

$ ghci -XTypeOperators
GHCi, version 6.8.1:  :? for help
Loading package base ... linking ... done.
Prelude> :t undefined :: a + b
undefined :: a + b :: + a b

Change History (7)

comment:1 Changed 10 years ago by nfrisby

Moreover, infix constructors - even those that are not operators - are also incorrectly printed.

data Report = AsExpected Outcome | Outcome `InsteadOf` Outcome

Note how GHC 6.8.2 prints the InsteadOf operator without the backticks:

*Correctness> :i Report
data Report = AsExpected Outcome | Outcome InsteadOf Outcome
        -- Defined at Correctness.hs:23:5-10

comment:2 Changed 10 years ago by simonpj

Test Case: ghci/scripts/ghci033

I have fixed the bug in the commend from Frisby:

Mon Aug  4 17:10:39 BST 2008
  * Fix the bug part of Trac #1930

However, the original report is a different point. In Haskell (+) is a type variable not a type constructor. So saying

  undefined :: a+b


  undefined :: forall (+), a, b.  (+) a b

Now, you could argue that the type variable (+) should be printed infix. But I'm planning to make (+) into a type constructor, as described here So I am disinclined to fix the original report in #1930.

Still I'll leave it open to remind me to do the infix-type-constructor thing. Yell if you think that the infix type constructor proposal is a Bad Idea.


comment:3 Changed 10 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:4 Changed 10 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:5 Changed 8 years ago by simonpj

Summary: infix type constructors are printed incorrectly by GHCMake operators into type constructors, rather than type variables
Type: bugfeature request
Type of failure: None/Unknown

I'm changing the title of this ticket, and making it a feature request, namely to make operators into type constructors rather than type variables. See the Haskell Prime ticket

comment:7 Changed 6 years ago by simonmar

Resolution: fixed
Status: newclosed

From the 7.6.1 release notes: "The behavior of the TypeOperator extension has changed: previously, only type operators starting with ":" were considered type constructors, and other operators were treated as type variables. Now type operators are always constructors. "

Note: See TracTickets for help on using tickets.