Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test kind inference for closed type families/T7939.
- Loading branch information
Richard Eisenberg
committed
Jun 27, 2013
1 parent
b8749bb
commit e38279d
Showing
8 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
{-# LANGUAGE TypeFamilies, PolyKinds #-} | ||
{-# LANGUAGE TypeFamilies, PolyKinds, DataKinds, TypeOperators #-} | ||
|
||
module T7939 where | ||
|
||
class Foo a where | ||
type Bar a | ||
type Bar a b | ||
|
||
type family F a | ||
type instance F Int = Bool | ||
|
||
type family G a where | ||
G Int = Bool | ||
|
||
type family H a where | ||
H False = True | ||
|
||
type family J a where | ||
J '[] = False | ||
J (h ': t) = True | ||
|
||
type family K a where | ||
K '[] = Nothing | ||
K (h ': t) = Just h | ||
|
||
type family L (a :: k) b :: k where | ||
L Int Int = Bool | ||
L Maybe Bool = IO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
:l T7939 | ||
:i Bar | ||
:k Bar | ||
:i F | ||
:k F | ||
:i G | ||
:k G | ||
:i H | ||
:k H | ||
:i J | ||
:k J | ||
:i K | ||
:k K |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,23 @@ | ||
class Foo (k :: BOX) (a :: k) where | ||
type family Bar (k :: BOX) (k :: BOX) (a :: k) :: k | ||
type family Bar (k :: BOX) (a :: k) b :: * | ||
-- Defined at T7939.hs:6:9 | ||
Bar :: k1 -> k | ||
Bar :: k -> * -> * | ||
type family F a :: * -- Defined at T7939.hs:8:13 | ||
type instance F Int -- Defined at T7939.hs:9:1 | ||
F :: * -> * | ||
type family G a :: * where G Int = Bool | ||
-- Defined at T7939.hs:11:13 | ||
G :: * -> * | ||
type family H (a :: Bool) :: Bool where H 'False = 'True | ||
-- Defined at T7939.hs:14:13 | ||
H :: Bool -> Bool | ||
type family J (k :: BOX) (a :: [k]) :: Bool where | ||
J k ('[] k) = 'False | ||
J k ((':) k h t) = 'True | ||
-- Defined at T7939.hs:17:13 | ||
J :: [k] -> Bool | ||
type family K (k :: BOX) (a :: [k]) :: Maybe k where | ||
K k ('[] k) = 'Nothing k | ||
K k ((':) k h t) = 'Just k h | ||
-- Defined at T7939.hs:21:13 | ||
K :: [k] -> Maybe k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{-# LANGUAGE TypeFamilies, PolyKinds #-} | ||
|
||
module T7939a where | ||
|
||
type family F a where | ||
F Int = Bool | ||
F Maybe = Char |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
T7939a.hs:7:5: | ||
Expecting one more argument to ‛Maybe’ | ||
The first argument of ‛F’ should have kind ‛*’, | ||
but ‛Maybe’ has kind ‛* -> *’ | ||
In the type ‛Maybe’ | ||
In the family declaration for ‛F’ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters