summaryrefslogtreecommitdiff
path: root/src/Erebos/Object/Internal.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2026-08-02 11:00:02 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2026-08-04 20:49:59 +0200
commitafaa0cc6790b55e2db31450d3a2951d524930585 (patch)
treeab2b284288d0d7324bc839636177b6b26a945904 /src/Erebos/Object/Internal.hs
parentb09e4fa7a0123c51b79c238d622970d343eade87 (diff)
Function to load Storable from Stored Object
Diffstat (limited to 'src/Erebos/Object/Internal.hs')
-rw-r--r--src/Erebos/Object/Internal.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Erebos/Object/Internal.hs b/src/Erebos/Object/Internal.hs
index b624d1c..778f80a 100644
--- a/src/Erebos/Object/Internal.hs
+++ b/src/Erebos/Object/Internal.hs
@@ -30,7 +30,7 @@ module Erebos.Object.Internal (
storeRecItems,
Load, LoadRec,
- evalLoad,
+ evalLoad, evalLoadWithObject,
loadCurrentRef, loadCurrentObject,
loadRecCurrentRef, loadRecItems,
@@ -454,8 +454,11 @@ newtype Load a = Load (ReaderT (Ref, Object) (Except ErebosError) a)
deriving (Functor, Applicative, Alternative, Monad, MonadPlus, MonadError ErebosError)
evalLoad :: Load a -> Ref -> a
-evalLoad (Load f) ref = either (error {- TODO throw -} . ((BC.unpack (showRef ref) ++ ": ") ++) . showErebosError) id $
- runExcept $ runReaderT f (ref, lazyLoadObject ref)
+evalLoad act ref = evalLoadWithObject act ref (lazyLoadObject ref)
+
+evalLoadWithObject :: Load a -> Ref -> Object -> a
+evalLoadWithObject (Load f) ref obj = either (error {- TODO throw -} . ((BC.unpack (showRef ref) ++ ": ") ++) . showErebosError) id $
+ runExcept $ runReaderT f ( ref, obj )
loadCurrentRef :: Load Ref
loadCurrentRef = Load $ asks fst