diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-02-26 16:41:12 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-03-02 16:31:04 +0000 |
commit | 772737195823ac399203ac4cc4b051d8028eee1d (patch) | |
tree | 1210ea87b41f5cec3ccd012fc1db3eb017d211e6 /compiler | |
parent | c5977c2e2951e9e346a8f4990d5a6bbdbf9cee0b (diff) | |
download | haskell-772737195823ac399203ac4cc4b051d8028eee1d.tar.gz |
Comments only
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/typecheck/TcTyClsDecls.hs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/typecheck/TcTyClsDecls.hs b/compiler/typecheck/TcTyClsDecls.hs index 034ff6f6ee..f6d4085c38 100644 --- a/compiler/typecheck/TcTyClsDecls.hs +++ b/compiler/typecheck/TcTyClsDecls.hs @@ -221,12 +221,6 @@ Kind checking is done thus: 3. Kind check the data type and class decls -Synonyms are treated differently to data type and classes, -because a type synonym can be an unboxed type - type Foo = Int# -and a kind variable can't unify with UnboxedTypeKind -So we infer their kinds in dependency order - We need to kind check all types in the mutually recursive group before we know the kind of the type variables. For example: @@ -245,9 +239,16 @@ just involve (->) and *: type R = Int# -- Kind # type S a = Array# a -- Kind * -> # type T a b = (# a,b #) -- Kind * -> * -> (# a,b #) -So we must infer their kinds from their right-hand sides *first* and then -use them, whereas for the mutually recursive data types D we bring into -scope kind bindings D -> k, where k is a kind variable, and do inference. +and a kind variable can't unify with UnboxedTypeKind. + +So we must infer the kinds of type synonyms from their right-hand +sides *first* and then use them, whereas for the mutually recursive +data types D we bring into scope kind bindings D -> k, where k is a +kind variable, and do inference. + +NB: synonyms can be mutually recursive with data type declarations though! + type T = D -> D + data D = MkD Int T Open type families ~~~~~~~~~~~~~~~~~~ |