definition:
|
flatProgToAbstract :: FCT.Prog -> ACT.CurryProg
flatProgToAbstract (FCT.Prog name is ts _ _) = ACT.CurryProg name is Nothing [] [] (filter (not . isPrefixOf "_Dict#" . typeDeclToName) (map flatTypeDeclToAbstract ts)) [] []
where
flatTypeDeclToAbstract t = case t of
(FCT.Type qn vis tvar cds) -> ACT.CType qn (flatVisiblityToAbstract vis) (map flatTypeVarToAbstract tvar) (map flatConstrDeclToAbstract cds) []
(FCT.TypeNew qn vis tvar c) -> ACT.CType qn (flatVisiblityToAbstract vis) (map flatTypeVarToAbstract tvar) [flatNewConsToAbstractCons c] []
flatVisiblityToAbstract v = case v of
FCT.Public -> ACT.Public
FCT.Private -> ACT.Private
flatTypeVarToAbstract (index, _) = (index, varName index)
flatConstrDeclToAbstract (FCT.Cons qn _ vis tes) = ACT.CCons qn (flatVisiblityToAbstract vis) (map flatTypeExprToAbstract tes)
flatNewConsToAbstractCons (FCT.NewCons qn vis te) = ACT.CCons qn (flatVisiblityToAbstract vis) [flatTypeExprToAbstract te]
flatTypeExprToAbstract fte = case fte of
FCT.TVar index -> ACT.CTVar (index, varName index)
FCT.FuncType t1 t2 -> ACT.CFuncType (flatTypeExprToAbstract t1) (flatTypeExprToAbstract t2)
FCT.TCons qn tes -> case tes of
[] -> ACT.CTCons qn
_ -> applyTC qn (map flatTypeExprToAbstract tes)
_ -> error "flatTypeExprToAbstract: forall quantifier not supported yet"
|
demand:
|
argument 1
|
deterministic:
|
deterministic operation
|
documentation:
|
--- Converts a flatcurry program to an abstractcurry program.
--- Extracts only the name, imports and type definitions.
---
--- Converts FCY type synonyms to ACT data declarations.
---
--- Naming scheme for type variables of polymorphic type definitions:
--- data T a ... z a1 ... z1 ... = ...
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{({Prog}) |-> {CurryProg}}
|
name:
|
flatProgToAbstract
|
precedence:
|
no precedence defined
|
result-values:
|
{CurryProg}
|
signature:
|
FlatCurry.Types.Prog -> AbstractCurry.Types.CurryProg
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|