Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
c30744cc
Commit
c30744cc
authored
Jun 21, 2013
by
eir@cis.upenn.edu
Browse files
Updates to support closed type families.
parent
a26bf928
Changes
52
Hide whitespace changes
Inline
Sidebyside
testsuite/tests/ghci/scripts/T4175.hs
View file @
c30744cc
...
...
@@ 17,8 +17,6 @@ instance C Int where
instance
C
()
where
type
D
()
()
=
Bool
type
family
E
a
type
instance
where
type
family
E
a
where
E
()
=
Bool
E
Int
=
String
\ No newline at end of file
testsuite/tests/ghci/scripts/T4175.stdout
View file @
c30744cc
type family A a b :: *  Defined at T4175.hs:4:13
type instance A (Maybe a) a  Defined at T4175.hs:6:15
type instance A Int Int  Defined at T4175.hs:5:15
data family B a  Defined at T4175.hs:8:13
data instance B ()  Defined at T4175.hs:9:15
class C a where
type family D a b :: *
 Defined at T4175.hs:12:10
type D () ()  Defined at T4175.hs:18:10
type D Int ()  Defined at T4175.hs:15:10
type family E a :: *  Defined at T4175.hs:20:13
type instance where
E ()  Defined at T4175.hs:23:5
E Int  Defined at T4175.hs:24:5
data () = ()  Defined in ‛GHC.Tuple’
instance C ()  Defined at T4175.hs:17:10
instance Bounded ()  Defined in ‛GHC.Enum’
instance Enum ()  Defined in ‛GHC.Enum’
instance Eq ()  Defined in ‛GHC.Classes’
instance Ord ()  Defined in ‛GHC.Classes’
instance Read ()  Defined in ‛GHC.Read’
instance Show ()  Defined in ‛GHC.Show’
type instance where
E ()  Defined at T4175.hs:23:5
E Int  Defined at T4175.hs:24:5
type D () ()  Defined at T4175.hs:18:10
type D Int ()  Defined at T4175.hs:15:10
data instance B ()  Defined at T4175.hs:9:15
data Maybe a = Nothing  Just a  Defined in ‛Data.Maybe’
instance Eq a => Eq (Maybe a)  Defined in ‛Data.Maybe’
instance Monad Maybe  Defined in ‛Data.Maybe’
instance Functor Maybe  Defined in ‛Data.Maybe’
instance Ord a => Ord (Maybe a)  Defined in ‛Data.Maybe’
instance Read a => Read (Maybe a)  Defined in ‛GHC.Read’
instance Show a => Show (Maybe a)  Defined in ‛GHC.Show’
type instance A (Maybe a) a  Defined at T4175.hs:6:15
data Int = GHC.Types.I# GHC.Prim.Int#  Defined in ‛GHC.Types’
instance C Int  Defined at T4175.hs:14:10
instance Bounded Int  Defined in ‛GHC.Enum’
instance Enum Int  Defined in ‛GHC.Enum’
instance Eq Int  Defined in ‛GHC.Classes’
instance Integral Int  Defined in ‛GHC.Real’
instance Num Int  Defined in ‛GHC.Num’
instance Ord Int  Defined in ‛GHC.Classes’
instance Read Int  Defined in ‛GHC.Read’
instance Real Int  Defined in ‛GHC.Real’
instance Show Int  Defined in ‛GHC.Show’
type instance where
E ()  Defined at T4175.hs:23:5
E Int  Defined at T4175.hs:24:5
type D Int ()  Defined at T4175.hs:15:10
type instance A Int Int  Defined at T4175.hs:5:15
type family A a b :: *  Defined at T4175.hs:4:13
type instance A (Maybe a) a  Defined at T4175.hs:6:1
type instance A Int Int  Defined at T4175.hs:5:1
data family B a  Defined at T4175.hs:8:13
data instance B ()  Defined at T4175.hs:9:15
class C a where
type family D a b :: *
 Defined at T4175.hs:12:10
type D () ()  Defined at T4175.hs:18:5
type D Int ()  Defined at T4175.hs:15:5
type family E a :: * where
E () = Bool
E Int = String
 Defined at T4175.hs:20:13
data () = ()  Defined in ‛GHC.Tuple’
instance C ()  Defined at T4175.hs:17:10
instance Bounded ()  Defined in ‛GHC.Enum’
instance Enum ()  Defined in ‛GHC.Enum’
instance Eq ()  Defined in ‛GHC.Classes’
instance Ord ()  Defined in ‛GHC.Classes’
instance Read ()  Defined in ‛GHC.Read’
instance Show ()  Defined in ‛GHC.Show’
type D () ()  Defined at T4175.hs:18:5
type D Int ()  Defined at T4175.hs:15:5
data instance B ()  Defined at T4175.hs:9:15
data Maybe a = Nothing  Just a  Defined in ‛Data.Maybe’
instance Eq a => Eq (Maybe a)  Defined in ‛Data.Maybe’
instance Monad Maybe  Defined in ‛Data.Maybe’
instance Functor Maybe  Defined in ‛Data.Maybe’
instance Ord a => Ord (Maybe a)  Defined in ‛Data.Maybe’
instance Read a => Read (Maybe a)  Defined in ‛GHC.Read’
instance Show a => Show (Maybe a)  Defined in ‛GHC.Show’
type instance A (Maybe a) a  Defined at T4175.hs:6:1
data Int = GHC.Types.I# GHC.Prim.Int#  Defined in ‛GHC.Types’
instance C Int  Defined at T4175.hs:14:10
instance Bounded Int  Defined in ‛GHC.Enum’
instance Enum Int  Defined in ‛GHC.Enum’
instance Eq Int  Defined in ‛GHC.Classes’
instance Integral Int  Defined in ‛GHC.Real’
instance Num Int  Defined in ‛GHC.Num’
instance Ord Int  Defined in ‛GHC.Classes’
instance Read Int  Defined in ‛GHC.Read’
instance Real Int  Defined in ‛GHC.Real’
instance Show Int  Defined in ‛GHC.Show’
type D Int ()  Defined at T4175.hs:15:5
type instance A Int Int  Defined at T4175.hs:5:1
testsuite/tests/indexedtypes/should_compile/Overlap1.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap1
where
type
family
F
a
type
instance
where
type
family
F
a
where
F
Int
=
Int
F
a
=
Bool
...
...
testsuite/tests/indexedtypes/should_compile/Overlap12.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap12
where
type
family
And
(
a
::
Bool
)
(
b
::
Bool
)
::
Bool
type
instance
where
type
family
And
(
a
::
Bool
)
(
b
::
Bool
)
::
Bool
where
And
False
x
=
False
And
True
x
=
x
And
x
False
=
False
...
...
@@ 12,5 +11,17 @@ type instance where
data
Proxy
p
=
P
i
::
Proxy
(
And
False
x
)
i
=
(
P
::
Proxy
False
)
\ No newline at end of file
a
::
Proxy
(
And
False
x
)
a
=
(
P
::
Proxy
False
)
b
::
Proxy
x
>
Proxy
(
And
True
x
)
b
x
=
x
c
::
Proxy
(
And
x
False
)
c
=
(
P
::
Proxy
False
)
d
::
Proxy
x
>
Proxy
(
And
x
True
)
d
x
=
x
e
::
Proxy
x
>
Proxy
(
And
x
x
)
e
x
=
x
testsuite/tests/indexedtypes/should_compile/Overlap13.hs
0 → 100644
View file @
c30744cc
{# LANGUAGE TypeFamilies #}
module
Overlap13
where
type
family
F
a
b
where
F
a
a
=
Int
F
a
Int
=
Int
F
a
b
=
b
g
::
a
>
F
a
Int
g
x
=
(
5
::
Int
)
testsuite/tests/indexedtypes/should_compile/Overlap14.hs
0 → 100644
View file @
c30744cc
{# LANGUAGE TypeFamilies #}
module
Overlap14
where
type
family
F
a
b
c
where
F
a
a
a
=
Int
F
Int
b
c
=
Bool
type
family
G
x
foo
::
F
Int
(
G
Bool
)
Bool
foo
=
False
testsuite/tests/indexedtypes/should_compile/Overlap2.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap2
where
type
family
F
a
b
type
instance
where
type
family
F
a
b
where
F
a
a
=
Int
F
a
b
=
Bool
...
...
testsuite/tests/indexedtypes/should_compile/T3017.stderr
View file @
c30744cc
TYPE SIGNATURES
emptyL :: forall a. ListColl a
test2 ::
forall c t t1. (Num t, Num t1, Coll c, Elem c ~ (t, t1)) => c > c
TYPE CONSTRUCTORS
Coll :: * > Constraint
class Coll c
RecFlag NonRecursive
type family Elem c :: *
empty :: c insert :: Elem c > c > c
ListColl :: * > *
data ListColl a
No C type associated
RecFlag NonRecursive, Promotable
= L :: forall a. [a] > ListColl a Stricts: _
FamilyInstance: none
COERCION AXIOMS
axiom Foo.TFCo:R:ElemListColl :: Elem (ListColl a) = a
INSTANCES
instance Coll (ListColl a)  Defined at T3017.hs:12:11
FAMILY INSTANCES
type Elem (ListColl a)  Defined at T3017.hs:13:
9
Dependent modules: []
Dependent packages: [base, ghcprim, integergmp]
TYPE SIGNATURES
emptyL :: forall a. ListColl a
test2 ::
forall c t t1. (Num t, Num t1, Coll c, Elem c ~ (t, t1)) => c > c
TYPE CONSTRUCTORS
Coll :: * > Constraint
class Coll c
RecFlag NonRecursive
type family Elem c :: *
empty :: c insert :: Elem c > c > c
ListColl :: * > *
data ListColl a
No C type associated
RecFlag NonRecursive, Promotable
= L :: forall a. [a] > ListColl a Stricts: _
FamilyInstance: none
COERCION AXIOMS
axiom Foo.TFCo:R:ElemListColl :: Elem (ListColl a) = a
INSTANCES
instance Coll (ListColl a)  Defined at T3017.hs:12:11
FAMILY INSTANCES
type Elem (ListColl a)  Defined at T3017.hs:13:
4
Dependent modules: []
Dependent packages: [base, ghcprim, integergmp]
testsuite/tests/indexedtypes/should_compile/T7585.hs
View file @
c30744cc
...
...
@@ 11,8 +11,7 @@ data SList :: [Bool] > * where
SNil
::
SList
'
[]
SCons
::
SBool
h
>
SList
t
>
SList
(
h
'
:
t
)
type
family
(
a
::
k
)
:==:
(
b
::
k
)
::
Bool
type
instance
where
type
family
(
a
::
k
)
:==:
(
b
::
k
)
::
Bool
where
'
[]
:==:
'
[]
=
True
(
h1
'
:
t1
)
:==:
(
h2
'
:
t2
)
=
True
a
:==:
b
=
False
...
...
testsuite/tests/indexedtypes/should_compile/all.T
View file @
c30744cc
...
...
@@ 200,6 +200,8 @@ test('T7082', normal, compile, [''])
test
('
Overlap1
',
normal
,
compile
,
[''])
test
('
Overlap2
',
normal
,
compile
,
[''])
test
('
Overlap12
',
normal
,
compile
,
[''])
test
('
Overlap13
',
normal
,
compile
,
[''])
test
('
Overlap14
',
normal
,
compile
,
[''])
test
('
T7156
',
normal
,
compile
,
[''])
test
('
T5591a
',
normal
,
compile
,
[''])
test
('
T5591b
',
normal
,
compile
,
[''])
...
...
testsuite/tests/indexedtypes/should_fail/
Overlap8
.hs
→
testsuite/tests/indexedtypes/should_fail/
NoGood
.hs
View file @
c30744cc
{# LANGUAGE TypeFamilies #}
module
Overlap8
where
type
family
F
a
b
type
instance
F
a
Int
=
Int
type
instance
where
F
Int
a
=
Int
F
a
b
=
Bool
type
instance
F
a
a
=
Int
type
instance
F
[
a
]
a
=
Bool
testsuite/tests/indexedtypes/should_fail/
T7560
.stderr
→
testsuite/tests/indexedtypes/should_fail/
NoGood
.stderr
View file @
c30744cc
T7560.hs:8:3
:
NoGood.hs:4:15
:
Conflicting family instance declarations:
F
Int
 Defined at
T7560.hs:8:3
F
Int
 Defined at
T7560.hs:12:3
F
a a
 Defined at
NoGood.hs:4:15
F
[a] a
 Defined at
NoGood.hs:5:15
testsuite/tests/indexedtypes/should_fail/Overlap10.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap10
where
type
family
F
a
b
type
instance
where
type
family
F
a
b
where
F
a
a
=
Int
F
a
b
=
b
...
...
testsuite/tests/indexedtypes/should_fail/Overlap10.stderr
View file @
c30744cc
Overlap10.hs:1
1
:7:
Overlap10.hs:1
0
:7:
Couldn't match expected type ‛F a Bool’ with actual type ‛Bool’
Relevant bindings include
g :: a > F a Bool (bound at Overlap10.hs:1
1
:1)
x :: a (bound at Overlap10.hs:1
1
:3)
g :: a > F a Bool (bound at Overlap10.hs:1
0
:1)
x :: a (bound at Overlap10.hs:1
0
:3)
In the expression: False
In an equation for ‛g’: g x = False
testsuite/tests/indexedtypes/should_fail/Overlap11.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap11
where
type
family
F
a
b
type
instance
where
type
family
F
a
b
where
F
a
a
=
Int
F
a
b
=
b
...
...
testsuite/tests/indexedtypes/should_fail/Overlap11.stderr
View file @
c30744cc
Overlap11.hs:1
1
:8:
Overlap11.hs:1
0
:8:
Couldn't match expected type ‛F a Int’ with actual type ‛Int’
Relevant bindings include
g :: a > F a Int (bound at Overlap11.hs:1
1
:1)
x :: a (bound at Overlap11.hs:1
1
:3)
g :: a > F a Int (bound at Overlap11.hs:1
0
:1)
x :: a (bound at Overlap11.hs:1
0
:3)
In the expression: (5 :: Int)
In an equation for ‛g’: g x = (5 :: Int)
testsuite/tests/indexedtypes/should_fail/Overlap3.hs
View file @
c30744cc
...
...
@@ 2,8 +2,7 @@
module
Overlap3
where
type
family
F
a
b
type
instance
where
type
family
F
a
b
where
F
a
a
=
Int
F
a
b
=
Bool
type
instance
F
Char
Char
=
Int
...
...
testsuite/tests/indexedtypes/should_fail/Overlap3.stderr
View file @
c30744cc
Overlap3.hs:7:3:
Conflicting family instance declarations:
F a a  Defined at Overlap3.hs:7:3
F Char Char  Defined at Overlap3.hs:9:15
Overlap3.hs:8:3:
Conflicting family instance declarations:
F a b  Defined at Overlap3.hs:8:3
F Char Char  Defined at Overlap3.hs:9:15
Overlap3.hs:8:1:
Illegal instance for closed family ‛F’
In the type instance declaration for ‛F’
testsuite/tests/indexedtypes/should_fail/Overlap4.hs
View file @
c30744cc
...
...
@@ 2,15 +2,7 @@
module
Overlap4
where
type
family
F
a
b
type
instance
F
Char
Char
=
Int
type
instance
where
F
a
a
=
Int
F
a
b
=
Bool
type
family
F
a
b
where
F
Int
Int
=
Bool
F
Bool
=
Maybe
g
::
F
Char
Double
g
=
False
h
::
F
Double
Double
h
=

2
testsuite/tests/indexedtypes/should_fail/Overlap4.stderr
View file @
c30744cc
Overlap4.hs:
6:15
:
Conflicting family instance declarations:
F Char Char  Defined at Overlap4.hs:6:15
F a a  Defined at Overlap4.hs:8:3
Overlap4.hs:
7:3
:
Number of parameters must match family declaration; expected 2
In the equations for closed type family ‛F’
In the family declaration for ‛F’
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment