Opened 23 months ago

Last modified 23 months ago

#11398 new feature request

Type application for operator sections

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

Description

With -fprint-explicit-foralls

(+ 1) :: forall {a}. Num a => a -> a

This means we cannot apply it to a type:

(+ 1) @Int :: Int -> Int

Since sections are sugar (+ 1) could be given the type forall a. Num a => a -> a instead.

Change History (1)

comment:1 Changed 23 months ago by goldfire

What's the typing rule you're proposing? It's awfully easy to find cases like this one where the behavior is straightforward, but coming up with a consistent rule is quite hard. Take const. What type should (`const` undefined) have? forall a. a -> a? forall a b. a -> a? What about (undefined `const`)?

In the end, I think this is a no-go, for exactly the same reason that applied functions have inferred type parameters, not specified ones.

Note: See TracTickets for help on using tickets.