Commit 7f1f5a57 authored by Jurriën Stutterheim's avatar Jurriën Stutterheim

Make Data.Heap compile again

parent fdd9a85a
......@@ -5,6 +5,7 @@ import StdClass
from Data.Maybe import :: Maybe
from StdFunc import o
import qualified Data.List as L
from Data.Monoid import class Monoid, class Semigroup
* Ported from Edward Kmett's Data.Heap by Jurriën Stutterheim 15-08-2014
......@@ -24,6 +25,10 @@ instance == (Heap a)
instance < (Heap a)
instance Semigroup (Heap a)
instance Monoid (Heap a)
:: Entry p a = Entry p a
null :: (Heap a) -> Bool
......@@ -266,9 +266,11 @@ fromListWith f xs :== 'SL'.foldr (insertWith f) mempty xs
//sort :: [a] -> [a] | Ord a
sort xs = 'DF'.toList (fromList xs)
instance Semigroup (Heap a) where
mappend l r = union l r
instance Monoid (Heap a) where
mempty = empty
mappend l r = union l r
// /O(n)/. Returns the elements in the heap in some arbitrary, very likely unsorted, order.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment