diff options
| author | Kleidi Bujari <mail@4kb.net> | 2026-07-23 11:25:39 -0700 |
|---|---|---|
| committer | Kleidi Bujari <mail@4kb.net> | 2026-10-04 18:21:44 -0700 |
| commit | 017f47a83b7b1d8f32982f58e688802735b14e9f (patch) | |
| tree | 0b49bc9a3853bb3a053c2fce67bb441a1581a04f /packages/code | |
| parent | fd81b9bd38f3ce5fbaa75b402ea23f8587e399f1 (diff) | |
| download | depot-hubris-devel.tar.gz depot-hubris-devel.tar.bz2 depot-hubris-devel.zip | |
Diffstat (limited to 'packages/code')
| -rw-r--r-- | packages/code/hubris/hubris.cabal | 26 | ||||
| -rw-r--r-- | packages/code/hubris/shell.nix | 28 | ||||
| -rw-r--r-- | packages/code/hubris/src/Hubris/Collections/LRUCache.hs | 16 |
3 files changed, 70 insertions, 0 deletions
diff --git a/packages/code/hubris/hubris.cabal b/packages/code/hubris/hubris.cabal new file mode 100644 index 0000000..dc9c06e --- /dev/null +++ b/packages/code/hubris/hubris.cabal @@ -0,0 +1,26 @@ +cabal-version: 3.14 +name: hubris +version: 0 +synopsis: Implementations of common data structures +-- description: +license: BSD-3-Clause +license-file: LICENSE +author: Kleidi Bujari +maintainer: mail@4kb.net +-- copyright: +build-type: Simple +extra-doc-files: CHANGELOG.md +-- extra-source-files: + +common warnings + ghc-options: -Wall + +library + import: warnings + -- other-modules: + -- other-extensions: + build-depends: base ^>=4.20.2.0, + containers >= 0.7 + hs-source-dirs: src + exposed-modules: Hubris.Collections.LRUCache + default-language: Haskell2010 diff --git a/packages/code/hubris/shell.nix b/packages/code/hubris/shell.nix new file mode 100644 index 0000000..0b01f77 --- /dev/null +++ b/packages/code/hubris/shell.nix @@ -0,0 +1,28 @@ +{ + pkgs ? import <nixpkgs> { }, + ... +}: + +pkgs.mkShell { + packages = with pkgs; [ + (haskellPackages.ghc.withPackages (p: [ + p.cabal-install + p.haskell-language-server + p.hasktags + p.hoogle + p.megaparsec + p.hakyll + p.pqueue + ])) + ]; + + nativeBuildInputs = with pkgs; [ + ormolu + typst + ]; + + buildInputs = with pkgs; [ + pkg-config + zlib + ]; +} 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 |
