CurryInfo: verify-non-fail-2.0.0 / Verify.ProgInfo.completeBranchesInFunc

definition:
 
completeBranchesInFunc :: [(QName,ConsInfo)] -> Bool -> FuncDecl -> FuncDecl
completeBranchesInFunc consinfos withanon = updFuncBody (updCases completeCase)
 where
  completeCase ct e brs = Case ct e $ case brs of
    []                           -> []
    Branch (LPattern _) _   : _  -> brs
    Branch (Pattern pc _) _ : bs -> brs ++
      let otherqs  = map ((\p -> (patCons p, length (patArgs p)))
                                    . branchPattern) bs
          siblings = siblingsOfCons consinfos pc
      in if withanon
           then if null (siblings \\ otherqs)
                  then []
                  else [Branch (Pattern anonCons []) fcFailed]
           else -- since the patterns variables are irrelevant, we use 100,...:
                map (\(qc,ar) -> Branch (Pattern qc (take ar [100..])) fcFailed)
                    (siblings \\ otherqs)
demand:
 no demanded arguments
deterministic:
 deterministic operation
documentation:
 
Complete all partial case branches occurring in the body of a function
by adding `Prelude.failed` branches. The first argument contains all data
constructors grouped by their data type. If the second argument is `True`,
only a single branch with an anonymous pattern is added (if necessary),
otherwise branches for all missing patterns are added.
failfree:
 <FAILING>
indeterministic:
 referentially transparent operation
infix:
 no fixity defined
iotype:
 {(_,_) |-> _}
name:
 completeBranchesInFunc
precedence:
 no precedence defined
result-values:
 _
signature:
 [((String, String), (Prelude.Int, ConsType, [((String, String), Prelude.Int)]))]
-> Prelude.Bool -> FlatCurry.Types.FuncDecl -> FlatCurry.Types.FuncDecl
solution-complete:
 operation might suspend on free variables
terminating:
 possibly non-terminating
totally-defined:
 possibly non-reducible on same data term