[GHC] #7828: RebindableSyntax and Arrow

GHC ghc-devs at haskell.org
Tue Jun 3 15:48:03 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:
----------------------------------------------+----------------------------

Comment (by ross):

 Replying to [comment:12 jstolarek]:
 > After spending some time on this today I have to admit that arrow
 desugaring is still a mystery to me. For example this code:
 >
 > {{{
 > proc n -> do
 >   x <- returnA -< n
 >   returnA -< x
 > }}}
 >
 > Is desugared to:
 >
 > {{{
 > arr (\n -> (n, ())) >>>
 > arr (\ds -> case ds of  { (ds2, ds3) -> ds2 }) >>>
 > arr (\ds -> ((ds, ()), ())) >>>
 > ((arr (\ds -> case ds of  { (ds2, ds3) -> ds2 }) >>> id) *** id >>>
 >         arr (\ds -> case ds of  { (x, ds2) -> case ds2 of  { () -> x }
 }) ) >>>
 > arr (\ds -> (ds, ())) >>>
 > arr (\ds -> case ds of { (ds2, ds3) -> ds2 }) >>>
 > id
 > }}}
 > This can be simplified to an identity (as expected), but GHC doesn't do
 it. This definitely seems like an opportunity for improvement.

 The simplifier reduces that to an identity using rules in Control.Arrow
 (though more rules are probably needed to handle slightly more complex
 cases).

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


More information about the ghc-tickets mailing list