[GHC] #13649: RebindableSyntax causes type errors when 'fail' is not defined, even if not used.
GHC
ghc-devs at haskell.org
Sat May 6 15:40:52 UTC 2017
#13649: RebindableSyntax causes type errors when 'fail' is not defined, even if not
used.
-------------------------------------+-------------------------------------
Reporter: AaronFriel | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1-rc1
Resolution: | Keywords:
| RebindableSyntax
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by nomeata):
This is not really a bug, but rather how `do` notation is specified. If
you look at
https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14
you will see
{{{
do {p <- e; stmts} = let ok p = do {stmts}
ok _ = fail "..."
in e >>= ok
}}}
One could argue that if the pattern is `_`, the second line should be
omitted, but where to stop? What about `do () <- …`, an obviously complete
pattern, should the `fail` line be omitted as well? But that information
might only be available after type-checking, whereas this happens before…
I don’t have an opinion of my own here, just pointing out that the current
behaviour is as specified, and that a change is not as trivial as it
looks.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13649#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list