summaryrefslogtreecommitdiff
path: root/packages/code/hubris/src/Hubris
diff options
context:
space:
mode:
authorKleidi Bujari <mail@4kb.net>2026-07-23 11:25:39 -0700
committerKleidi Bujari <mail@4kb.net>2026-10-04 18:21:44 -0700
commit017f47a83b7b1d8f32982f58e688802735b14e9f (patch)
tree0b49bc9a3853bb3a053c2fce67bb441a1581a04f /packages/code/hubris/src/Hubris
parentfd81b9bd38f3ce5fbaa75b402ea23f8587e399f1 (diff)
downloaddepot-017f47a83b7b1d8f32982f58e688802735b14e9f.tar.gz
depot-017f47a83b7b1d8f32982f58e688802735b14e9f.tar.bz2
depot-017f47a83b7b1d8f32982f58e688802735b14e9f.zip
Diffstat (limited to 'packages/code/hubris/src/Hubris')
-rw-r--r--packages/code/hubris/src/Hubris/Collections/LRUCache.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/code/hubris/src/Hubris/Collections/LRUCache.hs b/packages/code/hubris/src/Hubris/Collections/LRUCache.hs
new file mode 100644
index 0000000..995512d
--- /dev/null
+++ b/packages/code/hubris/src/Hubris/Collections/LRUCache.hs
@@ -0,0 +1,16 @@
+module Hubris.Collections.LRUCache
+ ( empty
+ , insert
+ ) where
+
+import qualified Data.Map as M
+import Data.Monoid (Sum (..))
+
+type LRUCache a = M.Map a (Sum Int)
+
+empty :: LRUCache a
+empty = M.empty
+
+insert :: a -> LRUCache a -> LRUCache a
+insert = M.alter (fmap $ const 0)
+ where