-- | analyse class decls
anaClassDecls :: ClassDecl -> State Env ClassDecl
anaClassDecls (ClassDecl cls k ps) =
    do cm <- gets classMap
       let Result ds (Just rk) = anaKindM k cm
       addDiags ds
       let ak = if null ds then k else universe
       mapM_ (addClassDecl rk ak) cls
       return $ ClassDecl cls ak ps

-- | store a class
anaClassDecls :: ClassDecl -> State Env ClassDecl
anaClassDecls (ClassDecl cls k ps) =
    do cm <- gets classMap
       let Result ds (Just rk) = anaKindM k cm
       addDiags ds
       let ak = if null ds then k else universe
       mapM_ (addClassDecl rk ak) cls
       return $ ClassDecl cls ak ps

-- | store a class
anaClassDecls (ClassDecl cls k ps) =
    do cm <- gets classMap
       let Result ds (Just rk) = anaKindM k cm
       addDiags ds
       let ak = if null ds then k else universe
       mapM_ (addClassDecl rk ak) cls
       return $ ClassDecl cls ak ps

-- | store a class