
I'm going to phrase this as a challenge, because I think that's likely to get the best response: I just released a package, th-kindshttp://hackage.haskell.org/package/th-kinds, which attempts to automatically infer the kind of a specified type, type constructor, type family, type class, or pretty much anything else that has a kind. This package was developed in response to a sort-of challenge from Brent Yorgey on #haskell to create this functionality. So, uh, I stayed up last night until 5 am learning unification algorithms and implementing this...heh. It rolls its own kind inference, so I don't know if it's adequately powerful to handle all the wacky types you can construct. Things I have tested it on: - IO and ST - Many primitive types, including unboxed tuples and State# - mtl - newtype Fix f = Fix (f (Fix f)) - data Tree a = Leaf a | Bin (Tree a) (Tree a) - data Foo a b = a (tests proper defaulting behavior) - A type family from my old TrieMap package with kind -- I kid you not -- ((* -> *) -> ((* -> *) -> * -> *) -> (* -> *) -> * -> * -> *) Things that it will not work on, and that I don't think will change: - GADT types that cannot be reified by TH. Essentially, I think this is "the set of GADT data types that actually couldn't be implemented without GADTs." Not sure, though. In any event, at the moment, I don't think there's any hope of handling GADTs in TH at this point, so I don't really object to this problem. Anyway, y'all should attempt to break th-kinds. Tell me if you can construct a type for which my inference checker breaks, but not because you get an error message saying "Can't reify a GADT data constructor..." By the way, I'd like to bump thesehttp://hackage.haskell.org/trac/ghc/ticket/3916 tickets http://hackage.haskell.org/trac/ghc/ticket/3920. They're certainly related, but I'm not sure if they're genuinely equivalent. It's really irritating, though, that kind parsing is so broken in TH, and I think that a TH backend guru should be able to figure out where there's a foldr instead of a foldl... th-kinds includes a workaround to this bug, but if the bug is fixed, it'll break again. Yuck, bugs. Louis Wasserman wasserman.louis@gmail.com http://profiles.google.com/wasserman.louis