Opened 3 years ago

Closed 3 years ago

#9900 closed bug (fixed)

Support pattern synonyms in GHCi

Reported by: cactus Owned by: cactus
Priority: normal Milestone: 7.10.1
Component: GHCi Version: 7.8.3
Keywords: PatternSynonyms Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: GHC rejects valid program Test Case:
Blocked By: #9915 Blocking:
Related Tickets: #8749, #7253 Differential Rev(s):
Wiki Page:

Description

Pattern synonyms are not parsed in GHCi:

λ» :set -XPatternSynonyms 
λ» pattern P x = x

<interactive>:5:1: parse error on input ‘pattern’

Change History (16)

comment:1 Changed 3 years ago by cactus

comment:2 Changed 3 years ago by cactus

comment:3 Changed 3 years ago by cactus

As part of this, I would need to add pattern as a declaration-introducing prefix to InteractiveUI.declPrefixes, but it has no way of being conditional on whether PatternSynonyms is turned on (see #9915).

comment:4 Changed 3 years ago by cactus

Blocked By: 9915 added

comment:5 Changed 3 years ago by cactus

Milestone: 7.10.17.8.4
Type of failure: None/UnknownGHC rejects valid program

comment:6 Changed 3 years ago by cactus

I have a fix for this on the wip/T9900 branch, but I'm waiting for instructions on how to trigger a Harbourmaster build on the branch before merging it to master.

comment:7 Changed 3 years ago by cactus

Status: newpatch

comment:8 Changed 3 years ago by thoughtpolice

Milestone: 7.8.47.10.1
Owner: cactus deleted
Status: patchnew

This isn't making it to 7.8.4; it's already done. We can put it in for 7.10 RC2, though.

comment:9 Changed 3 years ago by thoughtpolice

Owner: set to cactus

comment:10 Changed 3 years ago by thoughtpolice

Milestone: 7.10.17.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

comment:11 Changed 3 years ago by cactus

Milestone: 7.12.17.10.1
Status: newpatch
Type: feature requestbug

comment:12 Changed 3 years ago by Dr. ERDI Gergo <gergo@…>

In 0cc0cc8688ddb53db65a73d7d562e9564cfad22b/ghc:

Support pattern synonyms in GHCi (fixes #9900)

This involves recognizing lines starting with `"pattern "` as declarations,
keeping non-exported pattern synonyms in `deSugar`, and including
pattern synonyms in the result of `hscDeclsWithLocation`.

comment:13 Changed 3 years ago by cactus

Status: patchmerge

comment:14 Changed 3 years ago by Dr. ERDI Gergo <gergo@…>

In 6f818e083c8390b0c039bcebb6ec21b336d4173b/ghc:

Pattern synonyms do work in GHCi now (see #9900)

comment:15 Changed 3 years ago by cactus

Please make sure both of the above two commits are cherry-picked into 7.10.

comment:16 Changed 3 years ago by hvr

Resolution: fixed
Status: mergeclosed
Note: See TracTickets for help on using tickets.