reachableFromType :: ShallowType -> Reachability
reachableFromType t = case t of
  SOption qa -> reachableFromQVar qa
  SIndirection qa -> reachableFromQVar qa
  STuple qas -> reachableUnions $ map reachableFromQVar qas
  SRecord m _ _ -> reachableUnions $ map reachableFromQVar $ Map.elems m
  _ -> mzero

-- * Polyinstantiation

-- |Polyinstantiates a quantified type.
reachableFromType :: ShallowType -> Reachability
reachableFromType t = case t of
  SOption qa -> reachableFromQVar qa
  SIndirection qa -> reachableFromQVar qa
  STuple qas -> reachableUnions $ map reachableFromQVar qas
  SRecord m _ _ -> reachableUnions $ map reachableFromQVar $ Map.elems m
  _ -> mzero

-- * Polyinstantiation

-- |Polyinstantiates a quantified type.
reachableFromType t = case t of
  SOption qa -> reachableFromQVar qa
  SIndirection qa -> reachableFromQVar qa
  STuple qas -> reachableUnions $ map reachableFromQVar qas
  SRecord m _ _ -> reachableUnions $ map reachableFromQVar $ Map.elems m
  _ -> mzero

-- * Polyinstantiation

-- |Polyinstantiates a quantified type.