I've been tasked with creating a Haskell program that contains a definition for a polymorphic datatype Bag and some simple functions, such as, converting a list to a bag and checking if two bags are the same.
My problem is I'm new to Haskell, so I'm not sure how to use Bags. Can anyone point me in the direction of some resources to do with Bags?
Data.Map
to implement the same.I have given the definition using
Data.Map
to compare your implementation which I suppose you would be writing using your own algebraic data types.I have defined some very basic functions, but you can do things which you asked and a lot more, like