toList heap = case pop heap of
  Nothing -> []
  Just (p,a,h) -> (p,a) : toList h
toList heap = case pop heap of
  Nothing -> []
  Just (p,a,h) -> (p,a) : toList h
toList heap = case pop heap of
  Nothing -> []
  Just (p,a,h) -> (p,a) : toList h