Commit da008146 authored by bbr's avatar bbr
Browse files

io action to get the current nr of choices on top level

parent 8e074278
module Store
(Store,
emptyStore,addToStore,fromStore,
emptyStore,addToStore,fromStore, storeSize,
trace,vtrace,vtrace',
......@@ -63,4 +63,7 @@ addToStore (Store a) m x = trace ("add binding "++show m)
(Store (insert (deref m) x a))
fromStore :: Store -> OrRef -> Maybe Int
fromStore (Store a) n = lookup (deref n) a
\ No newline at end of file
fromStore (Store a) n = lookup (deref n) a
storeSize :: Store -> Int
storeSize (Store st) = size st
\ No newline at end of file
......@@ -128,3 +128,9 @@ try x _ = case consKind x of
orsWithOrRef :: Curry a => C_OrRef -> List a -> Result a
orsWithOrRef (C_OrRef r) xs _ = branching r (toHaskellList xs)
nrOfChoices :: Result (C_IO C_Int)
nrOfChoices st =
C_IO (\ st' -> Prelude.return (IOVal (toCurry (max (size' st) (size' st')))))
where
size' = maybe 0 storeSize
......@@ -11,7 +11,7 @@ module Unsafe(unsafePerformIO,trace,spawnConstraint,isVar,identicalVar,
showAnyTerm,showAnyQTerm,showAnyExpression,showAnyQExpression,
readsAnyUnqualifiedTerm,readAnyUnqualifiedTerm,readsAnyQTerm,
readAnyQTerm,
OrRef,try,ors
OrRef,try,orsWithOrRef,nrOfChoices
)
where
......@@ -171,4 +171,7 @@ try :: a -> Either a (OrRef,[a])
try external
orsWithOrRef :: OrRef -> [a] -> a
orsWithOrRef external
\ No newline at end of file
orsWithOrRef external
nrOfChoices :: IO Int
nrOfChoices external
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment