cyclicClassId :: ClassMap -> Id -> Kind -> Bool
cyclicClassId cm ci k = case k of
    FunKind _ k1 k2 _ -> cyclicClassId cm ci k1 || cyclicClassId cm ci k2
    ClassKind cj -> cj /= universeId &&
      (cj == ci || not (Set.null $ Set.filter (cyclicClassId cm ci)
          $ classKinds $ Map.findWithDefault (error "cyclicClassId") cj cm))

-- * subkinding

-- | keep only minimal elements according to 'lesserKind'
cyclicClassId :: ClassMap -> Id -> Kind -> Bool
cyclicClassId cm ci k = case k of
    FunKind _ k1 k2 _ -> cyclicClassId cm ci k1 || cyclicClassId cm ci k2
    ClassKind cj -> cj /= universeId &&
      (cj == ci || not (Set.null $ Set.filter (cyclicClassId cm ci)
          $ classKinds $ Map.findWithDefault (error "cyclicClassId") cj cm))

-- * subkinding

-- | keep only minimal elements according to 'lesserKind'
cyclicClassId cm ci k = case k of
    FunKind _ k1 k2 _ -> cyclicClassId cm ci k1 || cyclicClassId cm ci k2
    ClassKind cj -> cj /= universeId &&
      (cj == ci || not (Set.null $ Set.filter (cyclicClassId cm ci)
          $ classKinds $ Map.findWithDefault (error "cyclicClassId") cj cm))

-- * subkinding

-- | keep only minimal elements according to 'lesserKind'