definition: |
inferNFRule :: ProgInfo (TypeDecl, [Constructor]) -> Int -> TypeExpr -> TARule -> (Bool, [QName], TARule) inferNFRule _ _ _ r@(AExternal _ _) = (False, [], r) inferNFRule info arity ty' (ARule _ argVars expr) | canFail = (canFail, calls, ARule ty' argVars' expr') | otherwise = (False, [], ARule ty' (argVars' ++ rhsVars) (boolExpr "True")) -- Calls of non-failing functions can be omitted where (canFail, calls, expr') = inferNFExpr info expr argVars' = bArgs ++ argVars argIndxs = map fst argVars' freshVar = maximum (argIndxs ++ allVars expr') + 1 rhsVars = drop (length argVars') (addTypes2Vars (argIndxs ++ [freshVar ..]) (stripForall ty')) addTypes2Vars (v : vs) ty = case ty of FuncType t1 t2 -> (v, t1) : addTypes2Vars vs t2 _ -> [] bArgs = map (\(v, _) -> (starVar v, boolType)) argVars |
demand: |
argument 4 |
deterministic: |
deterministic operation |
documentation: |
--- Return transformed NFC rule along with information about called functions --- and whether the function can fail |
failfree: |
<FAILING> |
indeterministic: |
referentially transparent operation |
infix: |
no fixity defined |
iotype: |
{(_,_,_,{AExternal}) |-> {(,,)} || (_,_,_,{ARule}) |-> {(,,)}} |
name: |
inferNFRule |
precedence: |
no precedence defined |
result-values: |
{(,,)} |
signature: |
Analysis.ProgInfo.ProgInfo (FlatCurry.Types.TypeDecl, [((String, String), Prelude.Int)]) -> Prelude.Int -> FlatCurry.Types.TypeExpr -> FlatCurry.Annotated.Types.ARule FlatCurry.Types.TypeExpr -> (Prelude.Bool, [(String, String)], FlatCurry.Annotated.Types.ARule FlatCurry.Types.TypeExpr) |
solution-complete: |
operation might suspend on free variables |
terminating: |
possibly non-terminating |
totally-defined: |
possibly non-reducible on same data term |