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
Alex D
GHC
Commits
92ee7edc
Commit
92ee7edc
authored
Jul 20, 2001
by
simonpj
Browse files
[project @ 2001-07-20 16:51:58 by simonpj]
Add test for newtypes
parent
80c2dd39
Changes
2
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/typecheck/should_run/tcrun014.hs
0 → 100644
View file @
92ee7edc
-- !!! Newtypes
-- This one made ghc 5.01 (after newtype squashing) fall over
-- by generating Core code that contained a pattern match on
-- the InPE data constructor (which doesn't exist)
module
Main
where
data
Expr
e
=
One
e
|
Many
[
e
]
newtype
PExpr
a
=
InPE
(
Expr
(
PExpr
a
),
Int
)
one
::
Int
->
PExpr
e
->
PExpr
e
one
l
x
=
InPE
(
One
(
plus1
x
),
l
)
plus1
::
PExpr
a
->
PExpr
a
plus1
x
@
(
InPE
(
_
,
loc
))
=
InPE
(
Many
[
plus1
x
],
loc
)
get
::
PExpr
e
->
Int
get
(
InPE
(
_
,
l
))
=
l
main
=
print
(
get
(
plus1
(
InPE
(
Many
[]
,
0
))))
testsuite/tests/ghc-regress/typecheck/should_run/tcrun014.stdout
0 → 100644
View file @
92ee7edc
0
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