Opened 4 years ago

Closed 4 years ago

Last modified 18 months ago

#10954 closed feature request (duplicate)

Add class/context information to typed hole relevant bindings

Reported by: dfeuer Owned by:
Priority: normal Milestone: 8.0.1
Component: Compiler (Type checker) Version: 7.10.2
Keywords: TypedHoles Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #9479, #9091 Differential Rev(s):
Wiki Page:

Description

GHC's typed hole messages don't currently include any known context information for relevant bindings. For example:

bar :: a ~ b => a -> b -> Int
bar x y = _

gets me

    Found hole ‘_’ with type: Int
    Relevant bindings include
      y :: b (bound at <interactive>:8:42)
      x :: a (bound at <interactive>:8:40)
      bar :: a -> b -> Int (bound at <interactive>:8:36)
    In the expression: _
    In an equation for ‘bar’: bar x y = _

The types a and b are not unified, and the a ~ b constraint is not shown.

foo :: Show a => a -> Int
foo x = _

gets me

    Found hole ‘_’ with type: Int
    Relevant bindings include
      x :: a (bound at <interactive>:4:36)
      foo :: a -> Int (bound at <interactive>:4:32)
    In the expression: _
    In an equation for ‘foo’: foo x = _

The Show constraint is lost.

What I want

I'd like context information for all type variables in known bindings, so I can see all the pieces available to help me fill in the hole.

Related ticket

In #9479, Dominique Devriese wants to see any constraints on an ambiguously-typed hole.

Change History (3)

comment:1 Changed 4 years ago by dfeuer

Milestone: 8.0.1

comment:2 Changed 4 years ago by dfeuer

Resolution: duplicate
Status: newclosed

Duplicate of #9091

comment:3 Changed 18 months ago by simonpj

Keywords: TypedHoles added
Note: See TracTickets for help on using tickets.