Skip to content
GitLab
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
70834744
Commit
70834744
authored
Oct 14, 2005
by
simonpj
Browse files
[project @ 2005-10-14 11:23:46 by simonpj]
add some record-syntax stuff
parent
a0934074
Changes
5
Hide whitespace changes
Inline
Side-by-side
testsuite/tests/ghc-regress/gadt/all.T
View file @
70834744
...
...
@@ -24,3 +24,6 @@ test('tc', normal, compile_and_run, [''])
test
('
arrow
',
normal
,
compile
,
[''])
test
('
tdpe
',
normal
,
compile
,
[''])
test
('
Nilsson
',
normal
,
compile
,
[''])
test
('
records
',
normal
,
compile_and_run
,
[''])
test
('
records-fail1
',
normal
,
compile_fail
,
[''])
testsuite/tests/ghc-regress/gadt/records-fail1.hs
0 → 100644
View file @
70834744
{-# OPTIONS -fglasgow-exts #-}
-- Tests record syntax for GADTs
module
ShouldFail
where
data
T
a
where
T1
{
x
::
a
,
y
::
b
}
::
T
(
a
,
b
)
T4
{
x
::
Int
}
::
T
[
a
]
\ No newline at end of file
testsuite/tests/ghc-regress/gadt/records-fail1.stderr
0 → 100644
View file @
70834744
records-fail1.hs:7:0:
Constructors T1 and T4 have a common field `x',
but have different result types
In the data type declaration for `T'
testsuite/tests/ghc-regress/gadt/records.hs
0 → 100644
View file @
70834744
{-# OPTIONS -fglasgow-exts #-}
-- Tests record syntax for GADTs
module
Main
where
data
T
a
where
T1
{
x
::
a
,
y
::
b
}
::
T
(
a
,
b
)
T2
{
x
::
a
}
::
T
(
a
,
b
)
T3
{
z
::
Int
}
::
T
Bool
f
xv
yv
=
T1
{
x
=
xv
,
y
=
yv
}
g
::
T
a
->
T
a
g
(
T1
{
x
=
xv
,
y
=
yv
})
=
T2
{
x
=
xv
}
-- h :: Num a => T a any -> a
h
v
=
x
v
+
1
main
=
do
{
let
t1
=
T1
{
y
=
"foo"
,
x
=
4
}
t2
=
g
t1
;
print
(
h
(
f
8
undefined
))
;
print
(
h
t2
)
}
\ No newline at end of file
testsuite/tests/ghc-regress/gadt/records.stdout
0 → 100644
View file @
70834744
9
5
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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