[more support for first class existentials
John Meacham <john@repetae.net>**20060213093650] hunk ./DataConstructors.hs 61
+    tipe' (TExists [] (_ :=> t)) = tipe' t
hunk ./DataConstructors.hs 68
+    tipe' (TExists xs (_ :=> t)) = do
+        xs' <- flip mapM xs $ \tv -> do
+            --v <- newName [70,72..] () tv
+            --return $ tVr v (kind $ tyvarKind tv)
+            return $ (kind $ tyvarKind tv)
+        t' <- tipe' t
+        return $ ELit (LitCons (unboxedNameTuple TypeConstructor (length xs' + 1)) (t':xs') eHash)
hunk ./E/FromHs.hs 92
+    f (TExists xs (_ :=> t)) = let
+        xs' = map (kind . tyvarKind) xs
+        in ELit (LitCons (unboxedNameTuple TypeConstructor (length xs' + 1)) (f t:xs') eHash)
hunk ./FrontEnd/KindInfer.hs 353
+kiType varExist tap@(HsTyExists { hsTypeVars = vs, hsTypeType = qt }) = do
+    argKindVars <- mapM (newNameVar . hsTyVarBindName) vs
+    let newEnv = KindEnv $ Map.fromList $ argKindVars
+    extendEnv newEnv
+    kiQualType varExist qt
hunk ./FrontEnd/KindInfer.hs 413
+namesFromType HsTyExists { hsTypeVars = vs } = map (toName TypeVal . hsTyVarBindName) vs
hunk ./FrontEnd/KindInfer.hs 528
+aHsTypeToType kt (HsTyExists vs qt) = TExists (map (toTyvar kt . hsTyVarBindName) vs) (aHsQualTypeToQualType kt qt)
hunk ./FrontEnd/Representation.hs 34
+    tExists,
hunk ./FrontEnd/Representation.hs 74
+           | TExists { typeArgs :: [Tyvar], typeBody :: (Qual Type) }
hunk ./FrontEnd/Representation.hs 123
+tExists [] ([] :=> t) = t
+tExists vs (ps :=> TExists vs' (ps' :=> t)) = tExists (vs ++ vs') ((ps ++ ps') :=> t)
+tExists x y = TExists x y
+
hunk ./FrontEnd/Representation.hs 181
+            ft (TExists vs qt) = do
+                qt' <- flattenType' qt
+                return $ TExists vs qt'
hunk ./FrontEnd/Representation.hs 269
+           TExists vs t  -> do
+            r <- prettyPrintQualTypeM t
+            return $ text "(exists" <+> hsep (map pprint vs) <> text " . " <> r <> text ")"
hunk ./FrontEnd/Tc/Type.hs 141
+    f (TExists [] ([] :=> t)) = f t
+    f (TExists vs (ps :=> t)) = do
+        ts' <- mapM (newLookupName ['a'..] ()) vs
+        t' <- f t
+        ps' <- mapM fp ps
+        return $ case ps' of
+            [] ->  fixitize (N,-3) $ pop (text "exists" <+> hsep (map char ts') <+> text ". ")  (atomize t')
+            [p] -> fixitize (N,-3) $ pop (text "exists" <+> hsep (map char ts') <+> text "." <+> unparse p <+> text "=> ")  (atomize t')
+            ps ->  fixitize (N,-3) $ pop (text "exists" <+> hsep (map char ts') <+> text "." <+> tupled (map unparse ps) <+> text "=> ")  (atomize t')
hunk ./FrontEnd/Tc/Type.hs 222
+            ft (TExists vs qt) = do
+                when (any isMetaTV vs) $ error "metatv in forall binding"
+                qt' <- unVar' opt qt
+                return $ TExists vs qt'
hunk ./FrontEnd/Tc/Type.hs 275
-allFreeVars typ | ~(TForAll vs (_ :=> t)) <- typ = allFreeVars t List.\\ vs
+allFreeVars typ | (TForAll vs (_ :=> t)) <- typ = allFreeVars t List.\\ vs
+allFreeVars typ | ~(TExists vs (_ :=> t)) <- typ = allFreeVars t List.\\ vs
hunk ./FrontEnd/Tc/Type.hs 284
-freeMetaVars typ | ~(TForAll vs (_ :=> t)) <- typ = freeMetaVars t
+freeMetaVars typ | (TForAll vs (_ :=> t)) <- typ = freeMetaVars t
+freeMetaVars typ | ~(TExists vs (_ :=> t)) <- typ = freeMetaVars t
hunk ./FrontEnd/Tc/Type.hs 299
+        ft (TExists vs (ps :=> t)) = do
+            when (any isMetaTV vs) $ error "metatv in forall binding"
+            ps' <- sequence [ ft' t >>= return . IsIn c | ~(IsIn c t) <- ps ]
+            t' <- ft' t
+            return $ TExists vs (ps' :=> t')