Opened 2 years ago

Closed 20 months ago

Last modified 16 months ago

#13385 closed bug (fixed)

ghci fails to start when -XRebindableSyntax is passed

Reported by: mgsloan Owned by:
Priority: normal Milestone: 8.2.1
Component: GHCi Version: 8.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s): Phab:D3621
Wiki Page:


Running "ghci -XRebindableSyntax" yields the following output:

GHCi, version 8.0.2:  :? for help

<interactive>:1:6: error: Not in scope: ‘>>’

<interactive>:1:70: error: Not in scope: ‘>>’

<interactive>:1:135: error: Not in scope: ‘return’

This appears to be a regression, as it does not occur with ghc-7.10.3. Originally reported as a stack issue by Michal Konecny -

Change History (7)

comment:1 Changed 21 months ago by RyanGlScott


This was caused by 4905b83a2d448c65ccced385343d4e8124548a3b (Remote GHCi, -fexternal-interpreter).

comment:2 Changed 21 months ago by RyanGlScott

Differential Rev(s): Phab:D3621
Status: newpatch

comment:3 Changed 21 months ago by Ben Gamari <ben@…>

In 2abe54e1/ghc:

Make GHCi work when RebindableSyntax is enabled

Previously, we were running some blocks of code at the start of every
GHCi sessions which use do-notation, something which doesn't work well
if you start GHCi with the `-XRebindableSyntax` flag on. This tweaks the
code to avoid the use of do-notation so that `-XRebindableSyntax` won't
reject it.

Test Plan: make test TEST=T13385

Reviewers: austin, bgamari

Reviewed By: bgamari

Subscribers: rwbarton, thomie

GHC Trac Issues: #13385

Differential Revision:

comment:4 Changed 21 months ago by bgamari

Milestone: 8.4.1
Resolution: fixed
Status: patchclosed

comment:5 Changed 20 months ago by bgamari

Status: closedmerge

Michal Konečný has requested on ghc-devs that we merge this for 8.2. Given that it's a pretty trivial change, I'll do so.

comment:6 Changed 20 months ago by bgamari

Status: mergeclosed

comment:7 Changed 16 months ago by Ryan Scott <…>

In e023e78/ghc:

Disable -XRebindableSyntax when running internal GHCi expressions

It's well known that `-XRebindableSyntax` doesn't play
nicely with some of the internal expressions that GHCi runs. #13385
was one example where this problem arose, which was fixed at the time
by simply avoiding the use of `do`-notation in these internal GHCi
expressions. That seemed to work, but it was a technique that proved
not to scale, as #14342 demonstrated //another// example where
`-XRebindableSyntax` can bite.

Instead of delicately arranging the internal GHCi expressions to
avoid anything that might be covered under `-XRebindableSyntax`,
this patch takes the much more direct approach of disabling
`-XRebindableSyntax` entirely when running any internal GHCi
expression. This shouldn't hurt, since nothing internal to GHCi was
taking advantage of the extension in the first place, and moreover,
we can have greater confidence that some other obscure
`-XRebindableSyntax` corner case won't pop up in the future. As an
added bonus, this lets us once again use `do`-notation in the code
that had to be changed when #13385 was (hackily) fixed before.

Test Plan: make test TEST=T14342

Reviewers: bgamari, austin

Subscribers: rwbarton, thomie

GHC Trac Issues: #14342

Differential Revision:
Note: See TracTickets for help on using tickets.