
Maybe take a look at http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal | -----Original Message----- | From: haskell-cafe-bounces@haskell.org [mailto:haskell-cafe- | bounces@haskell.org] On Behalf Of Tillmann Rendel | Sent: 23 May 2012 18:20 | To: Haskell Café | Subject: Re: [Haskell-cafe] Typed TemplateHaskell? | | Hi Ilya, | | Ilya Portnov wrote: | > As far as can I see, using features of last GHC one could write typed | > TH library relatively easily, and saving backwards compatibility. | > | > For example, now we have Q monad and Exp type in "template-haskell" | > package. Let's imagine some new package, say "typed-template-haskell", | > with new TQ monad and new polymorphic type Exp :: * -> *. Using last | > GHC's features, one will easily write something like "expr :: Exp | > String", which will mean that "expr" represents a string expression. | > And we will need a new function, say runTQ :: TQ a -> Q a (or some | > more complicated type), which will turn TypedTemplateHaskell's | > constructs into plain TH. | | That would be a good thing to have. But it might be quite hard to | implement. For example, I guess you might want to have functions like | this one: | | apply :: Exp (a -> b) -> Exp a -> Exp b | | This function takes two typed expressions and produces an application. | The types ensure that the generated application will typecheck. Cool. | | But can you do the same thing for lambdas? Lambdas create functions, so | the type would be something like the following: | | lambda :: ... -> Exp (a -> b) | | But what would you put instead of the ...? | | I fear that overall, you would have to reimplement Haskell's type system | in Haskell's type system. Which sounds like a cool thing to do, but | maybe not so easily. | | Tillmann | | _______________________________________________ | Haskell-Cafe mailing list | Haskell-Cafe@haskell.org | http://www.haskell.org/mailman/listinfo/haskell-cafe