CurryInfo: icurry-3.2.0 / FlatCurry.CaseCompletion.completeExp

definition:
completeExp :: CaseOptions -> Expr -> Expr
completeExp _ (Var v) = Var v
completeExp _ (Lit l) = Lit l
completeExp opts (Comb ct qn es) =
  Comb ct qn (map (completeExp opts) es)
completeExp opts (Let bs e) =
  Let (zip (map fst bs) (map (completeExp opts . snd) bs)) (completeExp opts e)
completeExp opts (Free vs e) = Free vs (completeExp opts e)
completeExp opts (Or e1 e2) =
  Or (completeExp opts e1) (completeExp opts e2)
completeExp opts (Typed e te) = Typed (completeExp opts e) te
completeExp opts (Case ct e brs) = case brs of
  [] -> Case ct ce []
  Branch (LPattern _)   _ : _ ->  Case ct ce cbrs
  Branch (Pattern cn _) _ : _ ->
    let consdecls = snd (typeOfConstructor opts cn)
        sbrs = map (\c -> maybe (failedBranch c) id
                                (find (isBranchForCons c) cbrs))
                   consdecls
    in Case ct ce sbrs
 where
  isBranchForCons c (Branch pat _) = case pat of Pattern pn _ -> fst c == pn
                                                 _            -> False
  ce   = completeExp opts e
  cbrs = map (\ (Branch pat be) -> Branch pat (completeExp opts be)) brs
  failedBranch (c,ar) = Branch (Pattern c [101 .. 100+ar])
                               (Comb FuncCall ("Prelude","failed") [])
demand:
argument 2
deterministic:
deterministic operation
failfree:
(_, _)
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,{Var}) |-> {Var} || (_,{Lit}) |-> {Lit} || (_,{Comb}) |-> {Comb} || (_,{Let}) |-> {Let} || (_,{Free}) |-> {Free} || (_,{Or}) |-> {Or} || (_,{Typed}) |-> {Typed} || (_,{Case}) |-> {Case}}
name:
completeExp
precedence:
no precedence defined
result-values:
{Case,Comb,Free,Let,Lit,Or,Typed,Var}
signature:
CaseOptions -> FlatCurry.Types.Expr -> FlatCurry.Types.Expr
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term