Commit 02fc57a0 authored by Hans-Peter Deifel's avatar Hans-Peter Deifel
Browse files

Add Eq and Show instances to SumBag

This is a requirement for its use in copar and also allows for testing, since
`shouldBe` from hspec requires those two instances.
parent 9b761979
......@@ -16,6 +16,10 @@ import qualified Data.List.NonEmpty as NE
type SumBag a = Tree a
data Tree a = Leaf | Node (MetaData a) (Element a) (Tree a) (Tree a)
deriving (Show)
instance (Ord a, Eq a) => Eq (Tree a) where
x == y = toAscList x == toAscList y
type role Tree nominal
......@@ -23,11 +27,13 @@ data MetaData a = MetaData
{ nodeSize :: Int
, nodeSum :: a
deriving (Show)
data Element a = Element
{ value :: a
, multiplicity :: NE.NonEmpty a
deriving (Show)
empty :: SumBag a
Supports Markdown
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