okasaki

Okasaki's Purely Functional Data Structures
Log | Files | Refs | LICENSE

commit 02d09acf9bef8486af98a12b4fcf0e8a69755eda
parent e95b660dcc16ee7033490c0b2cb714308fa87a5d
Author: Jared Tobin <jared@jtobin.io>
Date:   Wed,  5 Apr 2023 22:10:29 +0400

Heap class skeleton.

Diffstat:
Mlib/Okasaki/Heap/Binomial.hs | 1-
Alib/Okasaki/Heap/Class.hs | 18++++++++++++++++++
Mokasaki.cabal | 1+
3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/lib/Okasaki/Heap/Binomial.hs b/lib/Okasaki/Heap/Binomial.hs @@ -1,5 +1,4 @@ {-# OPTIONS_GHC -Wall -fno-warn-unused-top-binds #-} -{-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE TemplateHaskell #-} module Okasaki.Heap.Binomial where diff --git a/lib/Okasaki/Heap/Class.hs b/lib/Okasaki/Heap/Class.hs @@ -0,0 +1,18 @@ + +module Okasaki.Heap.Class where + +import qualified Okasaki.Heap.Binomial as B +import qualified Okasaki.Heap.Leftist as L +import qualified Okasaki.Heap.Leftist.Weighted as W + +class Heap (h :: * -> *) where + bot :: Ord a => h a -> Maybe a + put :: Ord a => a -> h a -> h a + mer :: Ord a => h a -> h a -> h a + cut :: Ord a => h a -> h a + +instance Heap B.Heap where + bot = B.bot + put = B.put + mer = B.mer + cut = B.cut diff --git a/okasaki.cabal b/okasaki.cabal @@ -26,6 +26,7 @@ library Okasaki.Orphans exposed-modules: Okasaki.Heap.Binomial + , Okasaki.Heap.Class , Okasaki.Heap.Leftist , Okasaki.Heap.Leftist.Weighted , Okasaki.Map