[GHC] #7828: RebindableSyntax and Arrow
GHC
ghc-devs at haskell.org
Wed Jun 18 06:16:23 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 jstolarek):
> A command can have the form \ p -> cmd, and that's what we have here
Ah, so you used `\` to denote the command abstraction (`proc`), not a
lambda abstraction? That got me confused.
> > So if I want to typecheck the arrow desugaring I need to typecheck
*exactly* the form to which it will later be desugared, including all the
explicit stacks, etc?
>
> Yes you do, and that will be harder in the arrow case, because the local
environment is an explicit input to the resulting arrow, and the desugarer
feels free to trim unused variables from that environment, which will
change its type.
And that means that at the typechecking stage I have to exactly follow the
whole desugaring algorithm, right? Sounds non-trivial.
> It would probably be necessary to force the replacements for the arrow
combinators to be polymorphic in the environment.
This brings me to another question. So let's say the user rebinds `arr` to
some function with the type `(Arrow a, Foo b) => a b b`. Then, after
desugaring, `arr` is made to operate on data + environment, like in your
definition of `bind`: `arr (\ ((e,s),b) -> (e,(b,s)))`. So the type that
`arr` operates on may no longer be an instance of `Foo`. What happens? I
don't see a way out.
> Question: would it be possible as part of this refactoring to have a
sort of generalized (weaker) arrow that doesn't have arr?
From the discussion on ghc-devs it looks that this is out of scope of this
ticket - it probably deserves its own.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7828#comment:33>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list