CurryInfo: spicey-4.2.0 / Spicey.ControllerGeneration.showController

definition:
showController :: ControllerGenerator
showController erdname (Entity entityName attrs) relationships allEntities =
  let manyToManyEntities = manyToMany allEntities (Entity entityName attrs)
      manyToOneEntities  = manyToOne (Entity entityName attrs) relationships
      pvar               = (0, lowerFirst entityName)
      infovar            = (1, "sinfo")
  in
    controllerFunction
    ("Shows a " ++ entityName ++ " entity.")
    entityName "show" 1
      (baseType (model erdname,entityName) ~> controllerType)
      [simpleRule 
        [CPVar pvar] -- parameterlist for controller
        (applyF (pre "$")
            [applyF checkAuthorizationFunc
              [applyF (enauthModName,lowerFirst entityName ++ "OperationAllowed")
                [applyF (authorizationModule,"ShowEntity") [CVar pvar]]],
             CLambda [CPVar infovar] $ doExpr (
               map (\ (ename, num) ->                                           
                     CSPat (CPVar (num,lowerFirst                               
                                         (fst $ relationshipName entityName     
                                               ename relationships) ++ ename))  
                           (applyF (model erdname,"runJustT")                   
                              [applyF (controllerModuleName entityName,         
                                       "get"++ fst (relationshipName            
                                                entityName ename relationships) 
                                            ++ ename)                           
                                      [CVar pvar]                               
                              ])                                                
                   )                                                            
                   (zip (manyToOneEntities) [1..]) ++                           
               map (\ ((ename,erel), num) ->
                      CSPat (CPVar (num,lowerFirst erel ++ ename ++ "s"))
                            (applyF (model erdname,"runJustT")
                               [applyF (controllerModuleName entityName,
                                   "get" ++ erel ++ entityName ++ ename ++ "s")
                                       [CVar pvar]])
                   )
                   (zip manyToManyEntities [1..]) ++
              [CSExpr (
                 applyF (pre "return")
                    [applyF (viewFunctionName entityName "show")
                       ([CVar infovar, CVar pvar] ++
                        (map (\ (ename, num) ->                                 
                                CVar (num,lowerFirst (fst $ relationshipName    
                                             entityName ename relationships)    
                                           ++ ename))                           
                             (zip (manyToOneEntities) [1..])) ++                
                         (map (\ ((ename,erel), num) ->
                               CVar (num,lowerFirst erel ++ ename ++ "s"))
                             (zip manyToManyEntities [1..])))
                    ])
              ])
            ]
          )
      ]
demand:
argument 2
deterministic:
deterministic operation
documentation:
------------------------------------------------------------------------------
failfree:
<FAILING>
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{(_,{Entity},_,_) |-> _}
name:
showController
precedence:
no precedence defined
result-values:
_
signature:
String -> Database.ERD.Entity -> [Database.ERD.Relationship]
-> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
possibly non-reducible on same data term