CurryInfo: icurry-3.2.0 / ICurry.Interpreter.extendGraph

definition:
extendGraph :: Graph -> IEnv -> IExpr -> (Graph, Either NodeID Node)
extendGraph g0 env (IVar v) = (g0, Left $ lookupInEnv v env)
extendGraph g0 env (IVarAccess v path) =
  (g0, Left $ followPath g0 (lookupInEnv v env) path)
extendGraph g0 _ (ILit l) = (g0, Right $ ConsNode (showILit l) [])
extendGraph g0 env (IFCall (mn,c,_) es)
 | mn == "Prelude" && c == "unknown" && null es
 = (g0, Right FreeNode)
 | otherwise
 = let (g1,ns) = extendGraphL g0 env es
   in (g1, Right $ FuncNode c ns)
extendGraph g0 env (ICCall (_,c,_) es) =
  let (g1,ns) = extendGraphL g0 env es
  in (g1, Right $ ConsNode c ns)
extendGraph g0 env (IFPCall (_,c,_) m es) =
  let (g1,ns) = extendGraphL g0 env es
  in (g1, Right $ PartNode c (PartFuncCall m) ns)
extendGraph g0 env (ICPCall (_,c,_) m es) =
  let (g1,ns) = extendGraphL g0 env es
  in (g1, Right $ PartNode c (PartConsCall m) ns)
extendGraph g0 env (IOr e1 e2) =
  let (g1,[n1,n2]) = extendGraphL g0 env [e1,e2]
  in (g1, Right $ ChoiceNode (maxNodeID g1) n1 n2) -- TODO: better choice ids
demand:
argument 3
deterministic:
deterministic operation
documentation:
-- Extends a graph w.r.t. a given environment and ICurry expression
-- so that a expression is represented in the graph.
-- The result is either a node identifier of an existing node (if the
-- expression already exists in graph)  or the contents of a new node
-- to be added.
-- Used for assignments and return statements (ISimpleBlock).
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,_,{IVar}) |-> {(,)} || (_,_,{IVarAccess}) |-> {(,)} || (_,_,{ILit}) |-> {(,)} || (_,_,{IFCall}) |-> {(,)} || (_,_,{ICCall}) |-> {(,)} || (_,_,{IFPCall}) |-> {(,)} || (_,_,{ICPCall}) |-> {(,)} || (_,_,{IOr}) |-> {(,)}}
name:
extendGraph
precedence:
no precedence defined
result-values:
{(,)}
signature:
ICurry.Graph.Graph -> [(Prelude.Int, Prelude.Int)] -> ICurry.Types.IExpr
-> (ICurry.Graph.Graph, Prelude.Either Prelude.Int ICurry.Graph.Node)
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term