|
definition: |
fromPattern :: QName -> CPattern -> (Term QName, Subst QName)
fromPattern _ (CPVar (v, _)) = (TermVar v, emptySubst)
fromPattern _ (CPLit l) = (fromLiteral l, emptySubst)
fromPattern fn (CPComb c ps) =
let (ts, subs) = unzip (map (fromPattern fn) ps)
in (TermCons c ts, foldr composeSubst emptySubst subs)
fromPattern fn (CPAs (v, _) p) = let (t, sub) = fromPattern fn p
in (t, extendSubst sub v t)
fromPattern fn (CPFuncComb c ps) =
let (ts, subs) = unzip (map (fromPattern fn) ps)
in (TermCons c ts, foldr composeSubst emptySubst subs)
fromPattern fn (CPLazy p) = fromPattern fn p
fromPattern fn (CPRecord _ _) = error (pError "fromPattern" "CPRecord" fn)
|
|
demand: |
argument 2 |
|
deterministic: |
deterministic operation |
|
documentation: |
Transforms an abstract Curry pattern for the function with the given name into a pair of a term and a substitution. |
|
failfree: |
(_, _) |
|
indeterministic: |
referentially transparent operation |
|
infix: |
no fixity defined |
|
iotype: |
{(_,{CPVar}) |-> {(,)} || (_,{CPLit}) |-> {(,)} || (_,{CPComb}) |-> {(,)} || (_,{CPAs}) |-> {(,)} || (_,{CPFuncComb}) |-> {(,)} || (_,{CPLazy}) |-> {(,)}}
|
|
name: |
fromPattern |
|
precedence: |
no precedence defined |
|
result-values: |
{(,)}
|
|
signature: |
(String, String) -> AbstractCurry.Types.CPattern -> (Rewriting.Term.Term (String, String), Data.Map.Map Prelude.Int (Rewriting.Term.Term (String, String))) |
|
solution-complete: |
operation might suspend on free variables |
|
terminating: |
possibly non-terminating |
|
totally-defined: |
possibly non-reducible on same data term |