CurryInfo: call-analysis-3.2.0 / Analysis.transformExp

definition:
transformExp :: [(String,Bool)] -> [(String,[Int])] -> Term -> (Term,Bool,Int)
transformExp _ _ (Var i) = (Var i, False, 0)
transformExp ndinfos strinfos (Func Cons c args) =
  let (targs,ndargs,numopts) = unzip3 (map (transformExp ndinfos strinfos) args)
   in (Func Cons c targs, or ndargs, foldr (+) 0 numopts)
transformExp ndinfos strinfos (Func Def f args) =
  let (targs,ndargs,numopts) = unzip3 (map (transformExp ndinfos strinfos) args)
      isndexp = (maybe False id (lookup f ndinfos)) || or ndargs
      fsargs  = maybe [] id (lookup f strinfos)
      argopts = foldr (+) 0 numopts
      strictapplies = foldr (\si sargs -> replace (ndargs!!(si-1)) (si-1) sargs)
                            (take (length args) (repeat False))
                            fsargs
   in if null fsargs || not (or ndargs) || not (or strictapplies)
      then (Func Def f targs, isndexp, argopts)
      else (strictApply (Func Def f []) strictapplies targs, isndexp, argopts+1)
 where
  strictApply exp [] [] = exp
  strictApply exp (str:strs) (x:xs) =
    strictApply (Func Def (if str then "$!" else "$") [exp,x]) strs xs
demand:
argument 3
deterministic:
deterministic operation
documentation:
-- Transform expression w.r.t. non-determinism and strict information.
-- Returns:
-- * transformed expression
-- * is the expression non-deterministic?
-- * number of optimization transformations applied
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,_,{Var}) |-> {(,,)} || (_,_,{Func}) |-> {(,,)}}
name:
transformExp
precedence:
no precedence defined
result-values:
{(,,)}
signature:
[(String, Prelude.Bool)] -> [(String, [Prelude.Int])] -> TRS.Term
-> (TRS.Term, Prelude.Bool, Prelude.Int)
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term