DataAna.hs revision e774ab5733a1d673b123b0e63b14dd533e6fd4fc
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannModule : $Header$
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannCopyright : (c) Christian Maeder and Uni Bremen 2002-2003
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannLicence : similar to LGPL, see HetCATS/LICENCE.txt or LIZENZ.txt
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannMaintainer : hets@tzi.de
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannStability : provisional
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannPortability : non-portable (MonadState)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmannanalyse alternatives of data types
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannanaAlts :: Type -> [Alternative] -> State Env [AltDefn]
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannanaAlts dt alts = do ll <- mapM (anaAlt dt) alts
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann let l = concat ll
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann addDiags (checkUniqueness $ map
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann ( \ (Construct i _ _ _) -> i) l)
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannanaAlt :: Type -> Alternative -> State Env [AltDefn]
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannanaAlt _ (Subtype ts ps) =
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann do mapM_ anaStarType ts
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann addDiags [Diag Warning "data subtype ignored" $ firstPos ts ps]
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel HausmannanaAlt dt (Constructor i cs p _) =
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann do newCs <- mapM (anaComp i dt) $ zip cs $ map (:[]) [1..]
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann let mts = map fst newCs
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann if all isJust mts then
6a4fa2d53294f484fa8788a75656eff4ad1fd703Daniel Hausmann do let sels = concatMap snd newCs