Opened 2 years ago

Closed 2 years ago

Last modified 13 months ago

#10267 closed feature request (fixed)

Add support for typed holes in Template Haskell

Reported by: jstolarek Owned by: jstolarek
Priority: normal Milestone: 8.0.1
Component: Template Haskell Version: 7.10.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: th/T10267
Blocked By: Blocking:
Related Tickets: #10945, #10946 Differential Rev(s): Phab:D835
Wiki Page:

Description

I want to be able to work with typed holes using Template Haskell. These are currently rejected:

[d| i :: a -> a
    i x = _ |]
Expression form not (yet) handled by Template Haskell _

Change History (11)

comment:1 Changed 2 years ago by jstolarek

Owner: set to jstolarek

comment:2 Changed 2 years ago by simonpj

By all means add typed holes. Should not be hard.

Simon

comment:3 Changed 2 years ago by jstolarek

Yes, the implementation is actually a matter of ~30 minutes of hacking. There is one catch though: HsUnboundVar, used to represent holes, always stores RdrName. That becomes a problem in DsMeta, where we expect Names. My solution: parametrize HsUnboundVar with id like all the other constructors in HsExpr. I'm not certain if I got the details right - patch will require careful review in several place (I will mark those on Phab with inline comments).

comment:4 Changed 2 years ago by jstolarek

Differential Rev(s): Phab:D835

Looks like underestimated the difficulty of this - there are some issues with name handling. I will post details in a moment on Phab.

comment:5 Changed 2 years ago by jstolarek

I'd appreciate if anyone with more knowledge of name handling inside the renamer could take a look at the Phab revision. I'm blocked with this ticket at the moment but would love to push it forward.

comment:6 Changed 2 years ago by jstolarek

comment:7 Changed 2 years ago by Jan Stolarek <jan.stolarek@…>

In 75492e7/ghc:

Add typed holes support in Template Haskell.

Fixes #10267. Typed holes in typed Template Haskell currently don't work.
See #10945 and #10946.

comment:8 Changed 2 years ago by jstolarek

Resolution: fixed
Status: newclosed

comment:9 Changed 2 years ago by jstolarek

Test Case: th/T10267

comment:10 Changed 21 months ago by thomie

Milestone: 8.0.1

comment:11 Changed 13 months ago by Ben Gamari <ben@…>

In c6ac1e5/ghc:

users_guide: TH now partially supports typed holes

As requested in #10267. However we still lack support in typed splices.
See #10945 and #10946.
Note: See TracTickets for help on using tickets.