CurryInfo: rw-data-generator-2.0.0 / RW.Generator.generatorRead

definition:
generatorRead :: FunctionGenerator
generatorRead typedecl = return $ zipWith (forTargetCons (rwBaseModuleName rwNaming, "readRW")) [0..] tcs
 where
  tcs = typeCons typedecl
  forTargetCons rfn i (CCons name _ tes)
    = CRule (lhs (null tes) (codingI i (length tcs)))
        (CSimpleRhs (
          tupleExpr [
            applyF name (map (\index -> CVar (index + length tes, varName index ++ "'")) (fromIndex0 tes)),
            CVar (length tes, "r"++show (length tes))
          ]
        ) wheres)
   where
    wheres = map (\rn -> CLocalPat (
                            tuplePattern [CPVar (rn + length tes, varName rn ++ "'"), CPVar (rn+1, "r"++show (rn+1))]
                          ) (
                            CSimpleRhs (CApply (CApply (CSymbol rfn) (CVar (0, "strs"))) (CVar (rn, "r"++show rn))) []
                          )) (fromIndex0 tes)

  -- The left-hand side of the rule.
  lhs anon cs = [ strsPat 
                , listRestPattern (map pChar cs ++ [CPVar (1, "r0")])]
   where 
    strsPat | anon      = anonPattern
            | otherwise = CPVar (0, "strs")
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
--- read generator implementation
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_) |-> _}
name:
generatorRead
precedence:
no precedence defined
result-values:
_
signature:
AbstractCurry.Types.CTypeDecl -> RW.Monad.RWM [AbstractCurry.Types.CRule]
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term