CurryInfo: prolog2curry-1.2.0 / Language.Prolog.ToCurry.prolog2Curry

definition:
prolog2Curry :: TransState -> [PlClause] -> (CurryProg, TransState)
prolog2Curry ts cls =
  let (functiondirs, cls1)   = extractFunctonDirectives cls
      (constypespecs, cls2)  = extractTypeDirectives ts cls1
      (defconstrs,typespecs) = unzip constypespecs
      (predclauses,ignored)  = sortPredicates cls2
      allconstrsP = unionMap patsrhsconstrs (concatMap snd predclauses) \\
                      stdConstrs
      allconstrs = (if useLists ts then allconstrsP \\ [("[]",0), (".",2)]
                                   else allconstrsP) \\ concat defconstrs
      ts1 = ts { ignoredCls  = ignored
               , prologPreds = map (\ ((pn,ar),_) -> ((pn,ar),pn)) predclauses
               , prologCons  = allconstrs
               , resultArgs  = resultArgs ts ++ functiondirs }
      ts2 = if useAnalysis ts && withFunctions ts
              then analyzeClauses predclauses ts1
              else ts1
  in (simpleCurryProg (modName ts) ["Prelude"]
        (typespecs ++
         if null allconstrs then [] else [constrs2type ts allconstrs])
        (map (transPredClauses ts2) predclauses) [],
      ts2)
 where
  patsrhsconstrs (pats,goals) =
    union (unionMap termConstrs pats) (unionMap goalConstrs goals)

  stdConstrs = map (\o -> (o,2)) ["+","-","*","/"] ++
               map (\o -> (o,0)) ["true", "false"]
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
--- Translates a list of Prolog clauses into an AbstractCurry program
--- and return also the modified translation state.
failfree:
<FAILING>
indeterministic:
might be indeterministic
infix:
no fixity defined
iotype:
{(_,_) |-> {(,)}}
name:
prolog2Curry
precedence:
no precedence defined
result-values:
{(,)}
signature:
TransState -> [Language.Prolog.Types.PlClause]
-> (AbstractCurry.Types.CurryProg, TransState)
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term