[Git][ghc/ghc][wip/top-level-kind-signatures] bind_implicit

Vladislav Zavialov gitlab at gitlab.haskell.org
Tue May 14 20:33:43 UTC 2019



Vladislav Zavialov pushed to branch wip/top-level-kind-signatures at Glasgow Haskell Compiler / GHC


Commits:
7bc7e2e6 by Vladislav Zavialov at 2019-05-14T20:33:28Z
bind_implicit

- - - - -


2 changed files:

- compiler/typecheck/TcTyClsDecls.hs
- testsuite/tests/tlks/should_compile/all.T


Changes:

=====================================
compiler/typecheck/TcTyClsDecls.hs
=====================================
@@ -1139,6 +1139,9 @@ kcDeclHeader name flav ki ktvs kc_res_ki =
    -- ; (tv_prs, theta, tau) <- tcInstType tcInstSkolTyVars poly_id
    -- TODO (int-index): See Note [Instantiate sig with fresh variables]
   addTyConFlavCtxt name flav $
+    pushTcLevelM_ $    -- TODO (int-index): is this needed?
+    solveEqualities $  -- TODO (int-index): is this needed?
+    bind_implicit (hsq_ext ktvs) $
     go ki [] (hsq_explicit ktvs)
   where
     go :: Kind                  -- the TLKS kind
@@ -1209,6 +1212,14 @@ kcDeclHeader name flav ki ktvs kc_res_ki =
              Nothing -> return ()
          ; return $ mkTcTyCon name tcbs d_ki all_tv_prs True flav }
 
+    bind_implicit :: [Name] -> TcM a -> TcM a
+    bind_implicit tv_names thing_inside =
+      do { let new_tv name = do { kind <- newMetaKindVar
+                                ; tcv <- newPatSigTyVar name kind
+                                ; return (name, tcv) }
+         ; tcvs <- mapM new_tv tv_names
+         ; tcExtendNameTyVarEnv tcvs thing_inside }
+
 tooManyBindersErr :: Kind -> [LHsTyVarBndr GhcRn] -> SDoc
 tooManyBindersErr ki bndrs =
    hang (text "Not a function kind:")


=====================================
testsuite/tests/tlks/should_compile/all.T
=====================================
@@ -15,3 +15,4 @@ test('tlks012', normal, compile, [''])
 test('tlks013', normal, compile, [''])
 test('tlks014', normal, compile, [''])
 test('tlks015', normal, compile, [''])
+test('tlks016', normal, compile, [''])



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/7bc7e2e66a978d1a340ba9180235bf33a3fc1610

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/7bc7e2e66a978d1a340ba9180235bf33a3fc1610
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190514/994b1028/attachment-0001.html>


More information about the ghc-commits mailing list