diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-15 13:27:12 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2016-06-15 17:36:02 +0100 |
commit | e368f3265b80aeb337fbac3f6a70ee54ab14edfd (patch) | |
tree | c38b396e267a5f8172751daa8f985c22d6f92760 /testsuite/tests/ghci.debugger | |
parent | 77bb09270c70455bbd547470c4e995707d19f37d (diff) | |
download | haskell-e368f3265b80aeb337fbac3f6a70ee54ab14edfd.tar.gz |
Major patch to introduce TyConBinder
Before this patch, following the TypeInType innovations,
each TyCon had two lists:
- tyConBinders :: [TyBinder]
- tyConTyVars :: [TyVar]
They were in 1-1 correspondence and contained
overlapping information. More broadly, there were many
places where we had to pass around this pair of lists,
instead of a single list.
This commit tidies all that up, by having just one list of
binders in a TyCon:
- tyConBinders :: [TyConBinder]
The new data types look like this:
Var.hs:
data TyVarBndr tyvar vis = TvBndr tyvar vis
data VisibilityFlag = Visible | Specified | Invisible
type TyVarBinder = TyVarBndr TyVar VisibilityFlag
TyCon.hs:
type TyConBinder = TyVarBndr TyVar TyConBndrVis
data TyConBndrVis
= NamedTCB VisibilityFlag
| AnonTCB
TyCoRep.hs:
data TyBinder
= Named TyVarBinder
| Anon Type
Note that Var.TyVarBdr has moved from TyCoRep and has been
made polymorphic in the tyvar and visiblity fields:
type TyVarBinder = TyVarBndr TyVar VisibilityFlag
-- Used in ForAllTy
type TyConBinder = TyVarBndr TyVar TyConBndrVis
-- Used in TyCon
type IfaceForAllBndr = TyVarBndr IfaceTvBndr VisibilityFlag
type IfaceTyConBinder = TyVarBndr IfaceTvBndr TyConBndrVis
-- Ditto, in interface files
There are a zillion knock-on changes, but everything
arises from these types. It was a bit fiddly to get the
module loops to work out right!
Some smaller points
~~~~~~~~~~~~~~~~~~~
* Nice new functions
TysPrim.mkTemplateKiTyVars
TysPrim.mkTemplateTyConBinders
which help you make the tyvar binders for dependently-typed
TyCons. See comments with their definition.
* The change showed up a bug in TcGenGenerics.tc_mkRepTy, where the code
was making an assumption about the order of the kind variables in the
kind of GHC.Generics.(:.:). I fixed this; see TcGenGenerics.mkComp.
Diffstat (limited to 'testsuite/tests/ghci.debugger')
6 files changed, 32 insertions, 32 deletions
diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stderr b/testsuite/tests/ghci.debugger/scripts/break003.stderr index d069493986..36398dfda1 100644 --- a/testsuite/tests/ghci.debugger/scripts/break003.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break003.stderr @@ -1,5 +1,5 @@ <interactive>:4:1: error: - • No instance for (Show (t1 -> t)) arising from a use of ‘print’ + • No instance for (Show (t -> a)) arising from a use of ‘print’ (maybe you haven't applied a function to enough arguments?) • In a stmt of an interactive GHCi command: print it diff --git a/testsuite/tests/ghci.debugger/scripts/break003.stdout b/testsuite/tests/ghci.debugger/scripts/break003.stdout index 1d0844c6cc..d510a476ff 100644 --- a/testsuite/tests/ghci.debugger/scripts/break003.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break003.stdout @@ -1,6 +1,6 @@ Breakpoint 0 activated at ../Test3.hs:2:18-31 Stopped in Main.mymap, ../Test3.hs:2:18-31 -_result :: [t] = _ -f :: t1 -> t = _ -x :: t1 = _ -xs :: [t1] = [_] +_result :: [a] = _ +f :: t -> a = _ +x :: t = _ +xs :: [t] = [_] diff --git a/testsuite/tests/ghci.debugger/scripts/break005.stdout b/testsuite/tests/ghci.debugger/scripts/break005.stdout index 81eae63726..35e92d44f0 100644 --- a/testsuite/tests/ghci.debugger/scripts/break005.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break005.stdout @@ -4,7 +4,7 @@ a :: Integer = 1 left :: [Integer] = _ right :: [Integer] = _ Stopped in QSort.qsort, ../QSort.hs:5:17-26 -_result :: [t] = _ -left :: [t] = _ +_result :: [a] = _ +left :: [a] = _ () left = [] diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stderr b/testsuite/tests/ghci.debugger/scripts/break006.stderr index 463b66fcbf..7929e36cc2 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stderr +++ b/testsuite/tests/ghci.debugger/scripts/break006.stderr @@ -1,9 +1,9 @@ <interactive>:4:1: error: - • No instance for (Show t) arising from a use of ‘print’ - Cannot resolve unknown runtime type ‘t’ + • No instance for (Show a) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘a’ Use :print or :force to determine these types - Relevant bindings include it :: t (bound at <interactive>:4:1) + Relevant bindings include it :: a (bound at <interactive>:4:1) These potential instances exist: instance (Show b, Show a) => Show (Either a b) -- Defined in ‘Data.Either’ @@ -15,10 +15,10 @@ • In a stmt of an interactive GHCi command: print it <interactive>:6:1: error: - • No instance for (Show t) arising from a use of ‘print’ - Cannot resolve unknown runtime type ‘t’ + • No instance for (Show a) arising from a use of ‘print’ + Cannot resolve unknown runtime type ‘a’ Use :print or :force to determine these types - Relevant bindings include it :: t (bound at <interactive>:6:1) + Relevant bindings include it :: a (bound at <interactive>:6:1) These potential instances exist: instance (Show b, Show a) => Show (Either a b) -- Defined in ‘Data.Either’ diff --git a/testsuite/tests/ghci.debugger/scripts/break006.stdout b/testsuite/tests/ghci.debugger/scripts/break006.stdout index d8f1b65864..35fa44564c 100644 --- a/testsuite/tests/ghci.debugger/scripts/break006.stdout +++ b/testsuite/tests/ghci.debugger/scripts/break006.stdout @@ -1,13 +1,13 @@ Stopped in Main.mymap, ../Test3.hs:2:18-31 -_result :: [t] = _ -f :: Integer -> t = _ +_result :: [a] = _ +f :: Integer -> a = _ x :: Integer = 1 xs :: [Integer] = [2,3] xs :: [Integer] = [2,3] x :: Integer = 1 -f :: Integer -> t = _ -_result :: [t] = _ -y = (_t1::t) +f :: Integer -> a = _ +_result :: [a] = _ +y = (_t1::a) y = 2 xs :: [Integer] = [2,3] x :: Integer = 1 diff --git a/testsuite/tests/ghci.debugger/scripts/hist001.stdout b/testsuite/tests/ghci.debugger/scripts/hist001.stdout index 7ef5dc1e8e..9ae5688cb0 100644 --- a/testsuite/tests/ghci.debugger/scripts/hist001.stdout +++ b/testsuite/tests/ghci.debugger/scripts/hist001.stdout @@ -9,25 +9,25 @@ _result :: [a] = _ -6 : mymap (../Test3.hs:2:18-31) <end of history> Logged breakpoint at ../Test3.hs:2:22-31 -_result :: [t] -f :: t1 -> t -xs :: [t1] -xs :: [t1] = [] -f :: t1 -> t = _ -_result :: [t] = _ +_result :: [a] +f :: t -> a +xs :: [t] +xs :: [t] = [] +f :: t -> a = _ +_result :: [a] = _ Logged breakpoint at ../Test3.hs:2:18-20 -_result :: t -f :: Integer -> t +_result :: a +f :: Integer -> a x :: Integer -xs :: [t1] = [] +xs :: [t] = [] x :: Integer = 2 -f :: Integer -> t = _ -_result :: t = _ +f :: Integer -> a = _ +_result :: a = _ _result = 3 Logged breakpoint at ../Test3.hs:2:18-31 -_result :: [t] -f :: Integer -> t +_result :: [a] +f :: Integer -> a x :: Integer xs :: [Integer] Logged breakpoint at ../Test3.hs:2:18-20 -_result :: t +_result :: a |