[GHC] #7828: RebindableSyntax and Arrow

GHC ghc-devs at haskell.org
Wed Jul 16 07:10:11 UTC 2014


#7828: RebindableSyntax and Arrow
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:  jstolarek
  AlessandroVermeulen                |            Status:  new
                  Type:  bug         |         Milestone:  7.10.1
              Priority:  normal      |           Version:  7.6.2
             Component:  Compiler    |          Keywords:
  (Type checker)                     |  Operating System:  Unknown/Multiple
            Resolution:              |   Type of failure:  GHC rejects
Differential Revisions:              |  valid program
          Architecture:              |         Test Case:
  Unknown/Multiple                   |          Blocking:
            Difficulty:  Unknown     |
            Blocked By:              |
       Related Tickets:  #1537,      |
  #3613                              |
-------------------------------------+-------------------------------------

Comment (by jstolarek):

 Replying to [comment:43 ross]:
 > Replying to [comment:42 jstolarek]:
 > > I'm able to compile
 > >
 > > {{{
 > > test :: Arrow a => a i i
 > > test = proc n -> do
 > >          returnA -< n
 > > }}}
 > >
 > > using the new desugaring, which was not possible earlier.
 >
 > I wouldn't have expected any change in the handling of this.
 Hm... I just realized I probably misunderstood one thing. My desugaring is
 slightly different, but this is easy to fix.

 > If we're allowing rebinding, that should be type-checked and desugared
 exactly as if it were written
 >
 > {{{
 > test :: Arrow a => a i i
 > test = proc n -> (returnA -< n) `thenA` (returnA -< n)
 > }}}
 I believe that my implementation is doing exactly this. It's just that
 types don't match.

 > For the default `thenA`,
 > {{{
 > thenA :: Arrow a => a (e,s) b -> a (e,s) c -> a (e,s) c
 > u `thenA` v = arr id &&& u >>> arr fst >>> v
 > }}}
 > we have a1 = a2 = a, s1 = s2 = () and t = i, but with rebinding they'd
 be taken from the type of `thenA`, which could be anything matching the
 type in the above inference.

 At the moment my implementation does not work even for default `thenA`. I
 keep looking at the desugaring of monadic do-notation trying to figure out
 where did I go wrong.

 I guess the discussion here is more about the details of my
 implementation. To keep in line with [http://www.haskell.org/pipermail
 /ghc-devs/2014-July/005562.html recent decisions] I will move it to
 [https://phabricator.haskell.org/ Phab]. I'll post the link once I've
 created a new phabricator revision.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7828#comment:44>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list