Good to see you around, Sandy!

> On Mar 18, 2020, at 6:54 PM, Sandy Maguire <sa...@sandymaguire.me> wrote:
> 
> I mean if `insert :: a -> Container a -> Container a`, and I call it with 
> `[e| insert 5 True |]`, the quote will fail.

I don't observe this. Specifically, when I compile

> {-# LANGUAGE TemplateHaskellQuotes #-}
> 
> module Bug where
> 
> import Prelude ( Bool(..), undefined )
> 
> data Container a
> 
> insert :: a -> Container a -> Container a
> insert = undefined
> 
> quote = [e| insert 5 True |]

GHC happily succeeds.

I think what you want, though, is reasonable: you want the ability to send an 
expression through GHC's type-checker. I think we'd need to extend TH to be 
able to support this, and it will be hard to come up with a good design, I 
think. (Specifically, I'm worried about interactions with top-level defined 
entities, whose types might not really be known by the time of splice 
processing.) This might all be worthwhile -- singletons would be able to be 
improved with this, for example -- but it's not cheap, sadly.

Richard
_______________________________________________
ghc-devs mailing list
ghc-devs@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs

Reply via email to