[GHC] #7828: RebindableSyntax and Arrow

GHC ghc-devs at haskell.org
Mon Jun 2 14:27:01 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 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.

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


More information about the ghc-tickets mailing list