diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2015-09-02 13:28:34 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-09-02 13:30:00 +0200 |
commit | ff9432f600ca294fb747b0288dc10659d035d45e (patch) | |
tree | fe02c0d2a379a41da8c72cb7c0554bc41d9579e2 /testsuite | |
parent | 010e1878c9c851a638211a03fd58bfa6bdd93081 (diff) | |
download | haskell-ff9432f600ca294fb747b0288dc10659d035d45e.tar.gz |
Add test for updating a record with existentially quantified fields.
Test Plan: ./validate
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1193
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/typecheck/should_compile/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/typecheck/should_compile/update-existential.hs | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index d9f2bd8160..b469689445 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -469,3 +469,4 @@ test('T10564', normal, compile, ['']) test('T10632', normal, compile, ['']) test('T10642', normal, compile, ['']) test('T10744', normal, compile, ['']) +test('update-existential', normal, compile, ['']) diff --git a/testsuite/tests/typecheck/should_compile/update-existential.hs b/testsuite/tests/typecheck/should_compile/update-existential.hs new file mode 100644 index 0000000000..e216d1da01 --- /dev/null +++ b/testsuite/tests/typecheck/should_compile/update-existential.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE + NoImplicitPrelude + , ExistentialQuantification + #-} + +module Test where + +hGetContents handle_ = handle_{ haType=SemiClosedHandle} + +data HandleType = SemiClosedHandle + +class Show a where + show :: a -> a + +-- they have to check whether the handle has indeed been closed. +data Handle__ + = forall dev . (Show dev) => + Handle__ { + haDevice :: !dev, + haType :: HandleType -- type (read/write/append etc.) +} |