External Publication
Visit Post

Template haskell quotations guide

Haskell Community [Unofficial] June 1, 2026
Source

Because of Working towards a more stable Template Haskell, I’m trying to use quotes whenever possible in my template Haskell. Unfortunately, I don’t know what types are expected where in the template haskell quotes. (e.g. Pat, Con, Name, Expr) Is there a resource that says for example in [d| $n :: Int|], n :: Q Name or something? (I’m not actually sure what the expected type of n is ) I’ve been using AI + autocomplete to muddle through, but I’d like reliable documentation. Appreciated examples would be something that fills in boxes like the following:

[| newtype $(newtype' :: Q Name) = $(con' :: Q ?) $(type' :: Q ?) deriving anyclass ($(n :: ?))|]

Discussion in the ATmosphere

Loading comments...