
#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: ----------------------------------------------+---------------------------- Comment (by simonpj): Yes, I think if we made the change suggested here, arrow notation would become rebindable. I think the idea would be that each construct becomes decorated with the overloaded operations necessary to desugar it. Indeed, in the case of monad syntax, the effect is exactly as if you first desugared and then typechecked. For example `x <- e; rest` desugars into something like `e
= \x -> rest`. So to typecheck `x <- e` (a `BindStmt`), we look up `>>=`, instantiate its type, unify `e`'s type with the first argument type of `>>=`, and so on. We hang onto the instantiated `>>=` in the typechecked `BindStmt`.
The idea is to do the same for arrows, but I have little idea of how hard it is. But the thought experiment of first desugaring and then type checking may be an instructive one. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7828#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler