I apologise in case this doesn't make any sense. ghc -fglasgow-exts -fallow-undecidable-instances allows constructs which amount to lambda abstraction over types. I've written a small untyped lambda calculus interpreter in the Haskell class/instance sublanguage, just to prove this point. (The terms are Haskell *types*.) Using this interpreter as a basis, and adapting it as necessary, I can now write arbitrary "functions" [1] that take types to types. But of course it's a pain to write them like that. Maybe, after all, it does make sense to have a dedicated lambda-over-types Haskell extension which is convenient to use? [1] - I cannot produce an equivalent of
type Foo a b c = <some-function-over-types> a b c
but I can do an equivalent of this:
fun :: T1 -> T2 -> T3 -> <some-function-over-types> T1 T2 T3
-- anatoli __________________________________________________ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards� http://movies.yahoo.com/
anatoli <anatoli@yahoo.com> writes:
ghc -fglasgow-exts -fallow-undecidable-instances allows constructs which amount to lambda abstraction over types. I've written a small untyped lambda calculus interpreter in the Haskell class/instance sublanguage, just to prove this point. (The terms are Haskell *types*.)
Cool! Some time ago I wrote a Turing machine evaluator in Haskell types with undecidable instances. It's described at http://www.chttp://www.cl.cam.ac.uk/~kw217/research/misc/undec.html Enjoy! --KW 8-) -- Keith Wansbrough <kw217@cl.cam.ac.uk> http://www.cl.cam.ac.uk/users/kw217/ University of Cambridge Computer Laboratory.
participants (2)
-
anatoli -
Keith Wansbrough