<commit_before>-- Heap code from QuickSpec examples.
-- https://github.com/nick8325/quickspec/blob/0.9.6/examples/Heaps.hs
--
-- Copyright (c) 2009-2014, <NAME>
-- https://github.com/nick8325/quickspec/blob/0.9.6/LICENSE (BSD3 license)
module Heap where

data Heap a = Nil | Branch Int a (Heap a) (Heap a) deriving Show

instance Ord a => Eq (Heap a) where
  h1 == h2 = toList h1 == toList h2

toList :: Ord a => Heap a -> [a]
toList Nil = []
toList h   = findMin h : toList (deleteMin h)

fromList :: Ord a => [a] -> Heap a
fromList = foldr insert Nil

null :: Heap a -> Bool
null Nil = True
null _ = False
<commit_msg>bench/Heap: add Ord (Heap a) instance<commit_after>-- Heap code from QuickSpec examples.
-- https://github.com/nick8325/quickspec/blob/0.9.6/examples/Heaps.hs
--
-- Copyright (c) 2009-2014, <NAME>
-- https://github.com/nick8325/quickspec/blob/0.9.6/LICENSE (BSD3 license)
module Heap where

data Heap a = Nil | Branch Int a (Heap a) (Heap a) deriving Show

instance Ord a => Eq (Heap a) where
  h1 == h2 = toList h1 == toList h2

instance Ord a => Ord (Heap a) where
  h1 `compare` h2 = toList h1 `compare` toList h2

toList :: Ord a => Heap a -> [a]
toList Nil = []
toList h   = findMin h : toList (deleteMin h)

fromList :: Ord a => [a] -> Heap a
fromList = foldr insert Nil

null :: Heap a -> Bool
null Nil = True
null _ = False

{'fraction_non_alphanumeric': 0.14423076923076922, 'fraction_numerical': 0.042899408284023666, 'mean_word_length': 3.163076923076923, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1298357', 'n_tokens_mistral': 536, 'n_tokens_neox': 510, 'n_words': 174}