Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
bab57202
Commit
bab57202
authored
Jun 12, 2013
by
Simon Peyton Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test Trac
#7967
parent
23331488
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
+39
-0
testsuite/tests/indexed-types/should_fail/T7967.hs
testsuite/tests/indexed-types/should_fail/T7967.hs
+31
-0
testsuite/tests/indexed-types/should_fail/T7967.stderr
testsuite/tests/indexed-types/should_fail/T7967.stderr
+7
-0
testsuite/tests/indexed-types/should_fail/all.T
testsuite/tests/indexed-types/should_fail/all.T
+1
-0
No files found.
testsuite/tests/indexed-types/should_fail/T7967.hs
0 → 100644
View file @
bab57202
{-# LANGUAGE TypeFamilies, DataKinds, TypeOperators, GADTs #-}
module
T7967
where
data
Nat
=
Zero
|
Succ
Nat
data
SNat
::
Nat
->
*
where
SZero
::
SNat
Zero
SSucc
::
SNat
n
->
SNat
(
Succ
n
)
data
HList
::
[
*
]
->
*
where
HNil
::
HList
'
[]
HCons
::
h
->
HList
t
->
HList
(
h
'
:
t
)
data
Index
::
Nat
->
[
*
]
->
*
where
IZero
::
Index
Zero
(
h
'
:
t
)
ISucc
::
Index
n
l
->
Index
(
Succ
n
)
(
h
'
:
l
)
type
family
Lookup
(
n
::
Nat
)
(
l
::
[
*
])
::
*
type
instance
Lookup
Zero
(
h
'
:
t
)
=
h
type
instance
Lookup
(
Succ
n
)
(
h
'
:
t
)
=
Lookup
n
t
hLookup
::
Index
n
l
->
HList
l
->
Lookup
n
l
hLookup
IZero
(
HCons
h
_
)
=
h
hLookup
(
ISucc
n
)
(
HCons
_
t
)
=
hLookup
n
t
hLookup
_
_
=
undefined
-- So far, so good. But, I wanted a way to convert `SNat`s to `Index`es. When
-- I add the (wrong) code below, and got a bogus error above
sNatToIndex
::
SNat
n
->
HList
l
->
Index
n
l
sNatToIndex
SZero
HNil
=
IZero
testsuite/tests/indexed-types/should_fail/T7967.stderr
0 → 100644
View file @
bab57202
T7967.hs:31:26:
Couldn't match type ‛'[] *’ with ‛(':) * h0 t0’
Expected type: Index n l
Actual type: Index 'Zero ((':) * h0 t0)
In the expression: IZero
In an equation for ‛sNatToIndex’: sNatToIndex SZero HNil = IZero
testsuite/tests/indexed-types/should_fail/all.T
View file @
bab57202
...
...
@@ -98,3 +98,4 @@ test('T7560', normal, compile_fail, [''])
test
('
T7729
',
normal
,
compile_fail
,
[''])
test
('
T7729a
',
normal
,
compile_fail
,
[''])
test
('
T7786
',
normal
,
compile_fail
,
[''])
test
('
T7967
',
normal
,
compile_fail
,
[''])
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