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
49d4d2da
Commit
49d4d2da
authored
Sep 17, 2006
by
simonpj
Browse files
Tests for impredicative polymorphism
parent
03b6b86c
Changes
2
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/typecheck/should_compile/all.T
View file @
49d4d2da
...
...
@@ -223,6 +223,7 @@ test('tc207', normal, compile, [''])
test
('
tc208
',
normal
,
compile
,
[''])
test
('
tc209
',
normal
,
compile
,
[''])
test
('
tc210
',
normal
,
compile
,
[''])
test
('
tc211
',
normal
,
compile
,
[''])
# Omitting temporarily
# test('syn-perf', normal, compile, ['-fcontext-stack=30'])
...
...
testsuite/tests/ghc-regress/typecheck/should_compile/tc211.hs
0 → 100644
View file @
49d4d2da
{-# OPTIONS -fglasgow-exts #-}
-- Here are a bunch of tests for impredicative polymorphism
-- mainly written by Dimitrios
module
ShouldCompile
where
xs
::
[
forall
a
.
a
->
a
]
xs
=
[
\
x
->
x
]
foo
=
id
xs
-- Annotation resolves impredicative instantiation
bar
=
((
:
)
::
(
forall
a
.
a
->
a
)
->
[
forall
a
.
a
->
a
]
->
[
forall
a
.
a
->
a
])
(
head
foo
)
foo
-- result type resolves everything! really neat
barr
::
[
forall
a
.
a
->
a
]
barr
=
(
head
foo
)
:
(
tail
foo
)
zoo
=
tail
xs
zooo
=
head
xs
-- This is the only unsatisfactory case...annotating
-- one of the arguments does not do the job...but maybe
-- this is reasonable to expect ...
-- bar3 = ((head foo) :: forall a. a ->a) : foo
data
Pair
a
b
where
P
::
a
->
b
->
Pair
a
b
data
List
a
where
Nil
::
List
a
Cons
::
a
->
List
a
->
List
a
FromMono
::
(
a
->
a
)
->
List
(
forall
a
.
a
->
a
)
f
::
Int
->
Pair
Int
Int
f
x
=
P
x
x
h0
::
(
forall
a
.
a
->
a
)
->
Int
h0
g
=
let
y
=
P
(
g
3
)
(
g
(
P
3
4
))
in
3
h1
(
g
::
(
forall
a
.
a
->
a
))
=
let
y
=
P
(
g
3
)
(
g
(
P
3
4
))
in
3
h2
::
(
forall
a
.
a
->
a
)
->
Int
h2
(
g
::
(
forall
a
.
a
->
a
))
=
let
y
=
P
(
g
3
)
(
g
(
P
3
4
))
in
3
xs1
::
List
(
forall
a
.
a
->
a
)
xs1
=
let
cons
=
Cons
::
(
forall
a
.
a
->
a
)
->
List
(
forall
a
.
a
->
a
)
->
List
(
forall
a
.
a
->
a
)
in
cons
(
\
x
->
x
)
Nil
xs2
::
List
(
forall
a
.
a
->
a
)
xs2
=
(
Cons
::
((
forall
a
.
a
->
a
)
->
List
(
forall
a
.
a
->
a
)
->
List
(
forall
a
.
a
->
a
)))
(
\
x
->
x
)
Nil
foo2
::
forall
a
.
List
a
->
a
->
a
foo2
x
y
=
y
bar4
=
(
foo2
::
List
(
forall
a
.
a
->
a
)
->
(
forall
a
.
a
->
a
)
->
(
forall
a
.
a
->
a
))
xs1
(
\
x
->
x
)
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