ClassAna.hs revision e9458b1a7a19a63aa4c179f9ab20f4d50681c168
21155e63bac193abc764d791360132392eb79c4dcmaederDescription : analyse kinds using a class map
21155e63bac193abc764d791360132392eb79c4dcmaederCopyright : (c) Christian Maeder and Uni Bremen 2003-2005
21155e63bac193abc764d791360132392eb79c4dcmaederLicense : GPLv2 or higher, see LICENSE.txt
21155e63bac193abc764d791360132392eb79c4dcmaederMaintainer : Christian.Maeder@dfki.de
21155e63bac193abc764d791360132392eb79c4dcmaederStability : experimental
21155e63bac193abc764d791360132392eb79c4dcmaederPortability : portable
21155e63bac193abc764d791360132392eb79c4dcmaederanalyse kinds using a class map
21155e63bac193abc764d791360132392eb79c4dcmaederimport qualified Data.Map as Map
21155e63bac193abc764d791360132392eb79c4dcmaederimport qualified Data.Set as Set
21155e63bac193abc764d791360132392eb79c4dcmaeder-- * analyse kinds
21155e63bac193abc764d791360132392eb79c4dcmaeder-- | check the kind and compute the raw kind
21155e63bac193abc764d791360132392eb79c4dcmaederanaKindM :: Kind -> ClassMap -> Result RawKind
21155e63bac193abc764d791360132392eb79c4dcmaederanaKindM k cm = case k of
21155e63bac193abc764d791360132392eb79c4dcmaeder ClassKind ci -> if k == universe then return rStar
else case Map.lookup ci cm of
getFunKinds :: Monad m => ClassMap -> Kind -> m (Set.Set Kind)
FunKind {} -> return $ Set.singleton k
ClassKind c -> case Map.lookup c cm of
ks <- mapM (getFunKinds cm) $ Set.toList $ classKinds info
$ classKinds $ Map.findWithDefault (error "cyclicClassId") cj cm))
keepMinKinds cm = Set.fromDistinctAscList
newKind :: ClassMap -> Kind -> Set.Set Kind -> Bool
case Map.lookup c1 cm of
case Map.lookup ci tm of
Nothing -> case Map.lookup ci tvs of
Nothing -> case Map.lookup ci cm of
putClassMap $ Map.insert ci
(ClassInfo rk $ Set.singleton kind) cm
putClassMap $ Map.insert ci