Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
5e7a73c7
Commit
5e7a73c7
authored
Jan 02, 2009
by
simonpj
Browse files
Add comments to a very tricky test
parent
897361ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/typecheck/should_compile/tc163.hs
View file @
5e7a73c7
...
...
@@ -7,16 +7,31 @@
module
ShouldCompile
where
type
M3
a
=
forall
r
.
(
forall
b
.
M3'
b
->
(
b
->
M3'
a
)
->
r
)
->
r
type
M3
a
=
forall
r
.
(
forall
b
.
M3'
b
->
(
b
->
M3'
a
)
->
r
)
->
r
newtype
M3'
a
=
M3'
{
mkM3'
::
M3
a
}
newtype
M3'
a
=
M3'
{
mkM3'
::
M3
a
}
bind
::
M3
a
->
(
a
->
M3
b
)
->
M3
b
bind
m
k
b
=
b
(
M3'
m
)
(
\
a
->
M3'
(
k
a
)
)
flop
::
forall
a
b
.
M3'
b
->
(
b
->
M3
'
a
)
->
Int
flop
=
\
m'
k
->
mk
M3'
m
'
(
\
bm
k1
->
error
"urk"
)
observe
::
M3
a
->
a
observe
m
-- Suppose mkM3' has the straightforward type:
-- mkM3' :: forall a. M3' a -> M3 a
-- Then (mkM3' m') :: forall r. (forall b. ...) -> r
-- If we simply do a subsumption check of this against
-- alpha -> Int
-- where alpha is the type inferred for (\bm k1 ...)
-- this won't work.
-- But if we give mkM3' the type
-- forall a r. M3' a -> (forall b. ...) -> r
-- everthing works fine. Very very delicate.
---------------- A more complex case -------------
bind
::
M3
a
->
(
a
->
M3
b
)
->
M3
b
bind
m
k
b
=
b
(
M3'
m
)
(
\
a
->
M3'
(
k
a
))
observe
::
M3
a
->
a
observe
m
=
m
(
\
m'
k
->
mkM3'
m'
(
\
bm
k1
->
observe
(
bind
(
mkM3'
bm
)
(
\
a
->
bind
(
mkM3'
(
k1
a
))
(
\
a
->
mkM3'
(
k
a
)))))
...
...
Write
Preview
Supports
Markdown
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