8 | data BootstrapHeap : (Type -> Type) -> Type -> Type where
9 | E : BootstrapHeap h a
10 | H : a -> h (BootstrapHeap h a) -> BootstrapHeap h a
13 | Eq a => Eq (BootstrapHeap h a) where
15 | (H x' _) => case y of
16 | (H y' _) => x' == y'
19 | Ord a => Ord (BootstrapHeap h a) where
20 | compare x y = case x of
21 | (H x' _) => case y of
22 | (H y' _) => compare x' y'
26 | {h : Type -> Type} -> Heap h => Heap (BootstrapHeap h) where
31 | insert x h = merge (H x empty) h
35 | merge h1@(H x p1) h2@(H y p2) =
36 | if x <= y then H x (insert h2 p1) else H y (insert h1 p2)
38 | findMin h = case h of
39 | E => idris_crash "empty heap"
42 | deleteMin E = idris_crash "empty heap"
45 | else let (H y p1) = findMin p
47 | in (H y (merge p1 p2))