aboutsummaryrefslogtreecommitdiff
path: root/hsm-cam
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2025-08-27 04:10:47 +0000
committerPaul Oliver <contact@pauloliver.dev>2025-08-27 04:17:18 +0000
commitec1a6fba4c944d95edb2397b47b6cebc59e2758d (patch)
tree48e4eccaa30f6607ceac01e1f97007b8d39f0f00 /hsm-cam
parent3806bd1f5ce56afdbb4cc0c1ed54d53e25603be2 (diff)
Moves commonly used `bracket` combinators into separate module
Diffstat (limited to 'hsm-cam')
-rw-r--r--hsm-cam/Hsm/Cam.hs3
-rw-r--r--hsm-cam/hsm-cam.cabal2
2 files changed, 3 insertions, 2 deletions
diff --git a/hsm-cam/Hsm/Cam.hs b/hsm-cam/Hsm/Cam.hs
index c82cdd7..fe17057 100644
--- a/hsm-cam/Hsm/Cam.hs
+++ b/hsm-cam/Hsm/Cam.hs
@@ -44,6 +44,7 @@ import Hsm.Cam.FFI
, stopCamera
, stopCameraManager
)
+import Hsm.Core.Bracket (bracketConst, bracketLiftIO_)
import Hsm.Log (Log, Severity(Attention, Info, Trace), getLevel, logMsg, makeLoggerIO)
import MMAP (mapShared, mkMmapFlags, mmap, munmap, protRead)
import System.Directory (doesFileExist, removeFile)
@@ -127,8 +128,6 @@ runCam action = do
. bracketLiftIO_ createRequest (return ())
. bracket mapDmaBuffer unmapDmaBuffer $ \dmaBuffer -> evalStaticRep (Cam Rep {..}) action
where
- bracketConst alloc dealloc = bracket alloc dealloc . const
- bracketLiftIO_ alloc dealloc = bracket_ (liftIO alloc) (liftIO dealloc)
loggerAlloc = do
logMsg @"cam" Info "Registering FFI logger"
loggerIO <- makeLoggerIO @"cam"
diff --git a/hsm-cam/hsm-cam.cabal b/hsm-cam/hsm-cam.cabal
index 5c06ea7..fe767cb 100644
--- a/hsm-cam/hsm-cam.cabal
+++ b/hsm-cam/hsm-cam.cabal
@@ -13,6 +13,7 @@ library
, directory
, effectful-core
, effectful-plugin
+ , hsm-core
, hsm-log
, JuicyPixels
, monad-loops
@@ -44,6 +45,7 @@ executable test-cam
, directory
, effectful-core
, effectful-plugin
+ , hsm-core
, hsm-log
, JuicyPixels
, monad-loops