Re: [GHC] #7828: RebindableSyntax and Arrow

#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): In my work on the prototype I've ran into a problem I can't solve. Since desugaring of `HsCmdTop` [https://github.com/ghc/ghc/blob/165ac4af4a1002eff5f5a474bc21bc443c8f8c63/com... requires calls to arr and >>>] I've added two `SyntaxExpr` to `HsCmdTop` datatype. These two `SyntaxExpr`s [https://github.com/ghc/ghc/blob/165ac4af4a1002eff5f5a474bc21bc443c8f8c63/com... need to be typechecked in tcCmdTop]. I've see earlier how [https://github.com/ghc/ghc/blob/165ac4af4a1002eff5f5a474bc21bc443c8f8c63/com... typechecking of the do-notation bind is implemented] and decided to adopt a similar aproach: {{{ tcCmdTop env (L loc (HsCmdTop cmd _ _ names compose_op arr_op)) cmd_ty@(cmd_stk, res_ty) = setSrcSpan loc $ do { cmd' <- tcCmd env cmd cmd_ty ; names' <- mapM (tcSyntaxName ProcOrigin (cmd_arr env)) names -- VOODOO CODING based on typechecking of >>= in TcMatches -- is it correct to use b and c variables for typechecking in both -- arr and compose? ; a <- newFlexiTyVarTy liftedTypeKind ; b <- newFlexiTyVarTy liftedTypeKind ; c <- newFlexiTyVarTy liftedTypeKind ; arr_op' <- tcSyntaxOp DoOrigin arr_op (mkFunTy (mkFunTy b c) (mkCmdArrTy env b c)) ; compose_op' <- tcSyntaxOp DoOrigin compose_op (mkFunTys [mkCmdArrTy env a b, mkCmdArrTy env b c] (mkCmdArrTy env a c)) ; return (L loc $ HsCmdTop cmd' cmd_stk res_ty names' compose_op' arr_op') } }}} This however ends with a panic. Using `-dcore-lint` gives me this: {{{ *** Core Lint errors : in result of Desugar (after optimization) *** <no location info>: Warning: In the expression: T7828.>>> @ GHC.Prim.Any @ GHC.Prim.Any @ GHC.Prim.Any @ a_aEo @ (a_aEo, ()) @ a_aEo (T7828.arr @ GHC.Prim.Any @ GHC.Prim.Any @ a_aEo @ (a_aEo, ()) (\ (n_aus :: a_aEo) -> (n_aus, GHC.Tuple.()))) (T7828.>>> @ (a_aEo, ()) @ a_aEo @ a_aEo (T7828.arr @ (a_aEo, ()) @ a_aEo (\ (ds_dGU :: (a_aEo, ())) -> case ds_dGU of _ [Occ=Dead] { (ds_dGT, _ [Occ=Dead]) -> ds_dGT })) (T7828.returnA @ a_aEo)) Illegal type application: Exp type: T7828.R GHC.Prim.Any GHC.Prim.Any -> T7828.R GHC.Prim.Any GHC.Prim.Any -> T7828.R GHC.Prim.Any GHC.Prim.Any :: * Arg type: a_aEo :: * }}} These `GHC.Prim.Any` look wrong. Notice that there are two calls of `>>>` and `arr` but only one of each has these extra `GHC.Prim.Any` parameters. The incorrect `>>>` and `arr` are generated by my modified `HsCmdTop`. The other pair of `>>>` and `arr` is generated by `HsCmdArrApp` constructor, which has not been modified yet. Simon, help? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7828#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC