[Haskell-cafe] Typed TemplateHaskell?

David Fox ddssff at gmail.com
Fri May 25 19:31:17 CEST 2012


Its a much simpler thing, but I would like to see a template haskell
library and quasi-quoter that used a monad transformer instead of just Q.

On Thu, May 24, 2012 at 1:47 AM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:

> Maybe take a look at
>   http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal
>
> | -----Original Message-----
> | From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-
> | bounces at 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 at haskell.org
> | http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120525/d7469a69/attachment.htm>


More information about the Haskell-Cafe mailing list