definition:
|
genInstance :: CTypeDecl -> RWM CInstanceDecl
genInstance t = case t of
CType _ _ tvs _ _ -> do
fls <- getFunctionLayouts
funs <- mapM (genFunction t) fls
let baseMod = rwBaseModuleName rwNaming
return $ CInstance (baseMod, rwClassName rwNaming)
(CContext (classConstraint (rwClassName rwNaming) baseMod tvs))
[typeDeclToTypeExpr t] funs
_ -> error "(internal) Should've been a data declaration!"
|
demand:
|
argument 1
|
deterministic:
|
deterministic operation
|
documentation:
|
--- Generates a `ReadWrite` instance for a type declaration.
--- Given a type
---
--- T t1 ... tn = C1 c1_1 ... c1_k1 | ... | Cn cn_1 ... cn_kn
---
--- the function generates an instance
---
--- instance (ReadWrite t1, ..., ReadWrite tn) => ReadWrite (T t1 ... tn)
--- where read = ...
--- write = ...
--- ...
---
--- The concrete read and write (and/or possibly other) function generation
--- depends on the generator functions supplied by the concrete implementation.
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{({CType}) |-> _ || ({CTypeSyn}) |-> _ || ({CNewType}) |-> _}
|
name:
|
genInstance
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
AbstractCurry.Types.CTypeDecl -> RW.Monad.RWM AbstractCurry.Types.CInstanceDecl
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|