Not all splices are the same

David Feuer david.feuer at
Sun Jan 23 19:07:27 UTC 2022

I've been a bit upset by the challenges Template Haskell poses for type
inference. For example,

(3 :: Int) == $$(...)

may typecheck when

$$(...) == (3 :: Int)

does not. I don't imagine this problem can be solved in general, but I'm
rather curious whether it might be possible to solve for "pure" splices,
with types that look like

forall m. Quote m => Code m a

Would it be possible to get full bidirectional inference for these if they
were somehow marked specially by the user? For instance, if I wrote


that could mean e should be interpreted as having some type

PCode a


newtype PCode a = PCode (forall m. Quote m => a)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list