Skip to content
Snippets Groups Projects
Commit 1e542693 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

SumBag: Make datatype strict

This means that `insert undefined bag` now evaluates to undefined in WHNF.
parent 61868820
No related branches found
No related tags found
No related merge requests found
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE StrictData #-}
-- | == Multisets with constant-time fold.
--
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment