[allow unboxed values to be declared and used in haskell source files. modify kind and type checking accordingly
John Meacham <john@repetae.net>**20061110032151] hunk ./DataConstructors.hs 95
+kind (KBase KHash) = eHash
hunk ./E/FromHs.hs 106
+kind (KBase KHash) = eHash
hunk ./FrontEnd/KindInfer.hs 172
-constrain KindStar (KBase Star) = return ()
-constrain KindFunRet (KBase _) = return ()
+constrain KindStar        (KBase Star) = return ()
+constrain KindQuest       k@KBase {}  = kindCombine kindFunRet k >> return ()
+constrain KindQuestQuest  (KBase KQuest) = fail "cannot constraint ? to be ??"
+constrain KindQuestQuest  k@KBase {}  = kindCombine kindArg k >> return ()
hunk ./FrontEnd/KindInfer.hs 264
-    mapM_ (kiType kindStar) ts
+    mapM_ (kiType' kindStar) ts
hunk ./FrontEnd/KindInfer.hs 267
-    mapM_ (kiType kindStar) ts
+    flip mapM_ ts $ \t -> do
+        kt <- newKindVar KindQuestQuest
+        kiType (KVar kt) t
hunk ./FrontEnd/KindInfer.hs 272
-    kiType kindStar a
-    kv <- newKindVar KindFunRet
-    kiType (KVar kv) b
+    ka <- newKindVar KindQuestQuest
+    kb <- newKindVar KindQuest
+    kiType (KVar ka) a
+    kiType (KVar kb) b
hunk ./FrontEnd/KindInfer.hs 281
-    kv <- lookupKind KindSimple (toName TypeVal v)
+    kv <- lookupKind KindAny (toName TypeVal v)
hunk ./FrontEnd/KindInfer.hs 293
-    mapM initTyVarBind vs
+    mapM_ initTyVarBind vs
hunk ./FrontEnd/KindInfer.hs 300
-    mapM initTyVarBind vs
+    mapM_ initTyVarBind vs
hunk ./FrontEnd/KindInfer.hs 314
+hsKindToKind a | a == hsKindHash = kindHash
+hsKindToKind (HsKind n) = KBase (KNamed (toName SortName n))
hunk ./FrontEnd/KindInfer.hs 350
-            k' <- lookupKind KindSimple (toName TypeVal n)
+            k' <- lookupKind KindAny (toName TypeVal n)
hunk ./FrontEnd/KindInfer.hs 369
+kiDecl HsDataDecl { hsDeclContext = context, hsDeclName = tyconName, hsDeclArgs = args, hsDeclCons = [], hsDeclHasKind = Just kk } = do
+    args <- mapM (lookupKind KindSimple . toName TypeVal) args
+    kc <- lookupKind KindAny (toName TypeConstructor tyconName)
+    kiApps' kc args (hsKindToKind kk)
+    mapM_ kiPred context
hunk ./FrontEnd/KindInfer.hs 411
-    mapM_ (kiType kindStar) (concatMap (map hsBangType . hsConDeclArgs) condecls)
+    flip mapM_  (concatMap (map hsBangType . hsConDeclArgs) condecls) $ \t -> do
+        v <- newKindVar KindQuestQuest
+        kiType (KVar v) t
hunk ./FrontEnd/Representation.hs 235
-    z@(KBase KFunRet) -> newLookupName (map (('r':) . show) [0 :: Int ..]) z t
+    z@(KBase KQuest) -> newLookupName (map (('q':) . show) [0 :: Int ..]) z t
+    z@(KBase KQuestQuest) -> newLookupName (map (('q':) . ('q':) . show) [0 :: Int ..]) z t
hunk ./FrontEnd/Tc/Kind.hs 10
+    kindHash,
+    kindArg,
hunk ./FrontEnd/Tc/Kind.hs 22
+import Name.Name
hunk ./FrontEnd/Tc/Kind.hs 26
- KFunRet = ?
- KUTuple = (#)
- Star    = *
+ KQuest = ?        star or hash or unboxed tuple
+ KQuestQuest = ??  star or hash
+ KUTuple = (#)     unboxed tuple
+ Star    = *       boxed value
+ KHash   = #       unboxed value
hunk ./FrontEnd/Tc/Kind.hs 32
+ KNamed Foo = Foo  named kind
hunk ./FrontEnd/Tc/Kind.hs 36
-   ?
-  / \
- *  (#)
+       ?
+      / \
+     ?? (#)
+     /\
+    *  #
hunk ./FrontEnd/Tc/Kind.hs 42
+in addition, user defined named kinds are allowed. these can only occur via
+kind annotations, and only unify with themselves
hunk ./FrontEnd/Tc/Kind.hs 47
-data KBase = Star | KUTuple | KFunRet
+data KBase =
+        Star
+        | KHash
+        | KUTuple
+        | KQuestQuest
+        | KQuest
+        | KNamed Name
hunk ./FrontEnd/Tc/Kind.hs 57
-kindStar = KBase Star
+kindStar   = KBase Star
+kindHash   = KBase KHash
hunk ./FrontEnd/Tc/Kind.hs 60
-kindFunRet = KBase KFunRet
+kindFunRet = KBase KQuest
+kindArg    = KBase KQuestQuest
hunk ./FrontEnd/Tc/Kind.hs 72
-    f Star Star = return Star
-    f KUTuple KUTuple = return KUTuple
-    f KFunRet KFunRet = return KFunRet
+    f x y | x == y = return x
hunk ./FrontEnd/Tc/Kind.hs 74
-    f KFunRet Star = return Star
-    f Star KFunRet = return Star
-    f KFunRet KUTuple = return KUTuple
-    f KUTuple KFunRet = return KUTuple
+    f KQuest x = fquest x
+    f x  KQuest = fquest x
+    f KQuestQuest x = fquest2 x
+    f x  KQuestQuest = fquest2 x
hunk ./FrontEnd/Tc/Kind.hs 79
+    fquest (KNamed n) = fail $ "Attempt to unify named kind" <+> tshow n <+> "with ?"
+    fquest x = return x
+    fquest2 (KNamed n) = fail $ "Attempt to unify named kind" <+> tshow n <+> "with ??"
+    fquest2 KUTuple = fail $ "Attempt to unify unboxed tuple with ??"
+    fquest2 KQuest = return KQuestQuest
+    fquest2 x = return x
hunk ./FrontEnd/Tc/Kind.hs 90
-    = KindSimple  -- ^ * | kindSimple -> kindSimple
-    | KindFunRet  -- ^ ??, so * or (#) or ??
-    | KindStar    -- ^ must be *
-    | KindAny     -- ^ no constraints
+    = KindSimple     -- ^ * | kindSimple -> kindSimple
+    | KindQuest      -- ^ ?, so * or (#) or #
+    | KindQuestQuest -- ^ ??, * or #
+    | KindStar       -- ^ must be *
+    | KindAny        -- ^ may be anything
hunk ./FrontEnd/Tc/Kind.hs 97
+-- note that named kinds are never infered, so we don't need constraints
+-- mentioning them.
+
hunk ./FrontEnd/Tc/Kind.hs 105
-    mappend KindSimple KindFunRet = KindStar
+    mappend KindSimple KindQuest = KindStar
+    mappend KindSimple KindQuestQuest = KindStar
+    mappend KindQuest KindQuestQuest = KindQuestQuest
hunk ./FrontEnd/Tc/Kind.hs 133
-    showsPrec _ Star = showString "*"
+    showsPrec _ Star    = showString "*"
hunk ./FrontEnd/Tc/Kind.hs 135
-    showsPrec _ KFunRet = showString "?"
+    showsPrec _ KHash   = showString "#"
+    showsPrec _ KQuest  = showString "?"
+    showsPrec _ KQuestQuest = showString "??"
+    showsPrec _ (KNamed n) = shows n
hunk ./FrontEnd/Tc/Main.hs 85
-    bs <- sequence [ newBox kindStar | _ <- as ]
+    bs <- sequence [ newBox kindArg | _ <- as ]
hunk ./FrontEnd/Tc/Main.hs 203
-    arg <- newBox kindStar
-    arg2 <- newBox kindStar
-    ret <- newBox kindStar
+    arg <- newBox kindArg
+    arg2 <- newBox kindArg
+    ret <- newBox kindFunRet
hunk ./FrontEnd/Tc/Main.hs 240
-            withMetaVars mv [kindStar,kindFunRet] (\ [a,b] -> a `fn` b) $ \ [a,b] -> lam (p:ps) e (a `fn` b) rs
+            withMetaVars mv [kindArg,kindFunRet] (\ [a,b] -> a `fn` b) $ \ [a,b] -> lam (p:ps) e (a `fn` b) rs
hunk ./FrontEnd/Tc/Monad.hs 255
-            nvs <- mapM newVar  (replicate num kindStar)
+            nvs <- mapM newVar  (replicate num kindArg)
hunk ./FrontEnd/Tc/Monad.hs 402
-fixKind (KBase KFunRet) = KBase Star
+fixKind (KBase KQuestQuest) = KBase Star
+fixKind (KBase KQuest) = KBase Star