Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Software
CoPaR
Commits
1e542693
Commit
1e542693
authored
Mar 10, 2019
by
Hans-Peter Deifel
🐢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SumBag: Make datatype strict
This means that `insert undefined bag` now evaluates to undefined in WHNF.
parent
61868820
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
src/Data/SumBag.hs
src/Data/SumBag.hs
+1
-0
tests/Data/SumBagSpec.hs
tests/Data/SumBagSpec.hs
+4
-0
No files found.
src/Data/SumBag.hs
View file @
1e542693
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE StrictData #-}
-- | == Multisets with constant-time fold.
--
...
...
tests/Data/SumBagSpec.hs
View file @
1e542693
...
...
@@ -34,6 +34,10 @@ insertSpec = describe "insert" $ do
let
bag
=
iterate
(
SumBag
.
insert
(
si
1
))
SumBag
.
empty
!!
10
in
SumBag
.
toAscList
bag
`
shouldBe
`
(
replicate
10
(
si
1
))
it
"is strict"
$
let
bag
=
SumBag
.
insert
@
(
Sum
Int
)
(
error
""
)
SumBag
.
empty
in
seq
bag
(
return
()
)
`
shouldThrow
`
anyErrorCall
deleteSpec
::
Spec
deleteSpec
=
describe
"delete"
$
do
...
...
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