
#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):
Why not follow Ross's suggestions in comment 17?
If I understand correctly Ross' proposal is actually independent of this ticket: we could implement it and still have broken RebindableSyntax. That's why I chose to fix the rebindable syntax first. Perhaps then we can think about alternative desugaring of arrow syntax.
The VOODOO CODING is of course wrong.
Well, it is wrong, but I don't yet see why it is wrong. In my code I intended to check that `arr` has type `b -> c -> x b c` (where `x` is an arrow): {{{ arr_op' <- tcSyntaxOp DoOrigin arr_op (mkFunTy (mkFunTy b c) (mkCmdArrTy env b c)) }}} and that `>>>` has type `x a b -> x b c -> x a c`: {{{ compose_op' <- tcSyntaxOp DoOrigin compose_op (mkFunTys [mkCmdArrTy env a b, mkCmdArrTy env b c] (mkCmdArrTy env a c)) }}} I looked at the code you pointed me to and I don't yet see where I went wrong. Do you mean that I should not only check `arr` and `>>>` independently of everything else, but should also check that the type of the whole desugared expression - ie. `arr (\p -> ((xs),())) >>> c'` - is also correct?
Doing the instantiation once, at CmdTop will almost certainly not work.
Not sure if I understand what instantiation you mean. You refer to `arr` and `compose`? They are instantiated separately for each data constructor that needs them. `HsCmdTop` was just an example. At the moment I implemented your proposal: every constructor stores operators required for its desugaring and the `CmdSyntaxTable` has been removed. Typechecking is the missing part. I'll be taking a stab at it sometime later this week. There are some examples of typechecking arrows in `TcArrows`, which will hopefully get me on the right track. Once this is done I expect to get tons of minor bugs resulting from my voodoo programming. Hopefully, these will be easy to fix. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7828#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler