[GHC] #7828: RebindableSyntax and Arrow

GHC cvs-ghc at haskell.org
Wed Apr 10 16:49:38 CEST 2013


#7828: RebindableSyntax and Arrow
--------------------------------------+-------------------------------------
Reporter:  AlessandroVermeulen        |          Owner:                  
    Type:  bug                        |         Status:  new             
Priority:  normal                     |      Component:  Compiler        
 Version:  7.6.2                      |       Keywords:                  
      Os:  Unknown/Multiple           |   Architecture:  Unknown/Multiple
 Failure:  GHC rejects valid program  |      Blockedby:                  
Blocking:                             |        Related:                  
--------------------------------------+-------------------------------------
 When trying to add constraints to the types of the arrow primitives I get
 a type error. I think that doing such a thing should be possible and I've
 attached the code I used to test this. The errors I get when using the
 arrow notation for the function test are as follows:

 {{{
 test :: Typeable a => R a a
 test = proc n -> returnA -< n
 }}}

 {{{
 bug-arrow.hs:15:8:
     Could not deduce (Typeable c) arising from a use of `arr'
     from the context (Typeable a)
       bound by the type signature for test :: Typeable a => R a a
       at bug-arrow.hs:14:9-27
     Possible fix:
       add (Typeable c) to the context of
         a type expected by the context: (b -> c) -> R b c
         or the type signature for test :: Typeable a => R a a
     In the expression: arr
     When checking that `arr' (needed by a syntactic construct)
       has the required type: forall b1 c1. (b1 -> c1) -> R b1 c1
       arising from a proc expression at bug-arrow.hs:15:8-29
     In the expression: proc n -> returnA -< n

 bug-arrow.hs:15:8:
     Could not deduce (Typeable c) arising from a use of `>>>'
     from the context (Typeable a)
       bound by the type signature for test :: Typeable a => R a a
       at bug-arrow.hs:14:9-27
     Possible fix:
       add (Typeable c) to the context of
         a type expected by the context: R a1 b -> R b c -> R a1 c
         or the type signature for test :: Typeable a => R a a
     In the expression: (>>>)
     When checking that `(>>>)' (needed by a syntactic construct)
       has the required type: forall a2 b1 c1.
                              R a2 b1 -> R b1 c1 -> R a2 c1
       arising from a proc expression at bug-arrow.hs:15:8-29
     In the expression: proc n -> returnA -< n

 bug-arrow.hs:15:8:
     Could not deduce (Typeable d) arising from a use of `first'
     from the context (Typeable a)
       bound by the type signature for test :: Typeable a => R a a
       at bug-arrow.hs:14:9-27
     Possible fix:
       add (Typeable d) to the context of
         a type expected by the context: R b c -> R (b, d) (c, d)
         or the type signature for test :: Typeable a => R a a
     In the expression: first
     When checking that `first' (needed by a syntactic construct)
       has the required type: forall b1 c1 d1.
                              R b1 c1 -> R (b1, d1) (c1, d1)
       arising from a proc expression at bug-arrow.hs:15:8-29
     In the expression: proc n -> returnA -< n
 }}}

 When I replace the definition with the translated core code (minus type
 applications and scoped type variables) the code compiles:

 {{{
 test :: Typeable a => R a a
 test =
     (>>>)
       (arr (\ (n_apd) -> n_apd))
       ((>>>)
          (arr (\ (ds_dst) -> ds_dst))
          (returnA)
          )
 }}}

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



More information about the ghc-tickets mailing list