#include "HsVersions.h"
import HsSyn
+import TyCon ( DataConDetails(..) )
import Outputable
import Char ( isSpace )
+import Util ( count )
\end{code}
%************************************************************************
trim ls = takeWhile (not.isSpace) (dropWhile isSpace ls)
- fixity_ds = length [() | FixD d <- decls]
+ fixity_ds = count (\ x -> case x of { FixD{} -> True; _ -> False}) decls
-- NB: this omits fixity decls on local bindings and
-- in class decls. ToDo
inst_decls = [d | InstD d <- decls]
inst_ds = length inst_decls
- default_ds = length [() | DefD _ <- decls]
+ default_ds = count (\ x -> case x of { DefD{} -> True; _ -> False}) decls
val_decls = [d | ValD d <- decls]
real_exports = case exports of { Nothing -> []; Just es -> es }
n_exports = length real_exports
- export_ms = length [() | IEModuleContents _ <- real_exports]
+ export_ms = count (\ e -> case e of { IEModuleContents{} -> True;_ -> False})
+ real_exports
export_ds = n_exports - export_ms
export_all = case exports of { Nothing -> 1; other -> 0 }
spec_info (Just (False, _)) = (0,0,0,0,1,0)
spec_info (Just (True, _)) = (0,0,0,0,0,1)
- data_info (TyData {tcdNCons = nconstrs, tcdDerivs = derivs})
- = (nconstrs, case derivs of {Nothing -> 0; Just ds -> length ds})
+ data_info (TyData {tcdCons = DataCons cs, tcdDerivs = derivs})
+ = (length cs, case derivs of {Nothing -> 0; Just ds -> length ds})
data_info other = (0,0)
class_info decl@(ClassDecl {})