Commit 1e542693 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel 🐢

SumBag: Make datatype strict

This means that `insert undefined bag` now evaluates to undefined in WHNF.
parent 61868820
{-# 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment