Not all splices are the same

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 $$$e that could mean e should be interpreted as having some type PCode a where newtype PCode a = PCode (forall m. Quote m => a)

Seems related to https://gitlab.haskell.org/ghc/ghc/-/issues/18211
There is also a small section in my thesis (4.1.2) which explains why
changing the implementation of typed quotations would allow this
program to be accepted.
Matt
On Sun, Jan 23, 2022 at 7:08 PM David Feuer
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
$$$e
that could mean e should be interpreted as having some type
PCode a
where
newtype PCode a = PCode (forall m. Quote m => a) _______________________________________________ ghc-devs mailing list ghc-devs@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
participants (2)
-
David Feuer
-
Matthew Pickering