[GHC] #7828: RebindableSyntax and Arrow
GHC
ghc-devs at haskell.org
Mon Jun 16 22:31:35 UTC 2014
#7828: RebindableSyntax and Arrow
----------------------------------------------+----------------------------
Reporter: AlessandroVermeulen | Owner:
Type: bug | jstolarek
Priority: normal | Status: new
Component: Compiler (Type checker) | Milestone: 7.10.1
Resolution: | Version: 7.6.2
Operating System: Unknown/Multiple | Keywords:
Type of failure: GHC rejects valid program | Architecture:
Test Case: | Unknown/Multiple
Blocking: | Difficulty: Unknown
| Blocked By:
| Related Tickets: #1537,
| #3613
----------------------------------------------+----------------------------
Comment (by simonpj):
I wrote
> We are typechecking `pat <- rhs; body` as if it was `(>>=) rhs (\x ->
body)`. So we instantiate `(>>=)`, expecting its type to have the shape
> {{{
> rhs_ty -> (pat_ty -> body_ty)
> }}}
> That's what `tcSyntaxOp` does.
>
> Then we check that `pat` really does have type `pat_ty` and `rhs` really
does have type `rhs_ty`.
The last sentence is terribly important! We are not just checking that
`(>>=)` has a type of the right shape (which is, I gather from your
question, what you think is going on), ''but also that it's type can be
instantiated to match the particular pattern `pat` and the particular rhs
`rhs`''. You aren't doing that with `(>>>)` which is why you have all
those uninstantiated type variables.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7828#comment:29>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list