lookupMemSpace :: Lua.LuaInteger -> MemSpace a -> ExceptT GrLang.Error LuaGrLang a
lookupMemSpace idx' memSpace = do
  let idx = fromEnum idx'
  result <- liftIO $ readArray (cells memSpace) idx
  case result of
    Nothing -> GrLang.throwError Nothing "Value has unallocated index"
    Just val -> return val
lookupMemSpace :: Lua.LuaInteger -> MemSpace a -> ExceptT GrLang.Error LuaGrLang a
lookupMemSpace idx' memSpace = do
  let idx = fromEnum idx'
  result <- liftIO $ readArray (cells memSpace) idx
  case result of
    Nothing -> GrLang.throwError Nothing "Value has unallocated index"
    Just val -> return val
lookupMemSpace idx' memSpace = do
  let idx = fromEnum idx'
  result <- liftIO $ readArray (cells memSpace) idx
  case result of
    Nothing -> GrLang.throwError Nothing "Value has unallocated index"
    Just val -> return val