CurryInfo: icurry-3.2.0 / FlatCurry.CaseCompletion.completeExp

definition: Info
 
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: Info
 argument 2
deterministic: Info
 deterministic operation
failfree: Info
 (_, _)
indeterministic: Info
 referentially transparent operation
infix: Info
 no fixity defined
iotype: Info
 {(_,{Var}) |-> {Var} || (_,{Lit}) |-> {Lit} || (_,{Comb}) |-> {Comb} || (_,{Let}) |-> {Let} || (_,{Free}) |-> {Free} || (_,{Or}) |-> {Or} || (_,{Typed}) |-> {Typed} || (_,{Case}) |-> {Case}}
name: Info
 completeExp
precedence: Info
 no precedence defined
result-values: Info
 {Case,Comb,Free,Let,Lit,Or,Typed,Var}
signature: Info
 CaseOptions -> FlatCurry.Types.Expr -> FlatCurry.Types.Expr
solution-complete: Info
 operation might suspend on free variables
terminating: Info
 possibly non-terminating
totally-defined: Info
 possibly non-reducible on same data term