The TemplateHaskell quoting documents two quotes (''
) as the way to get the Name of a type:
> ''String
GHC.Base.String
This works fine for this type (name). However, I can't find a way to make it work nice for e.g. Maybe String
:
> ''Maybe String -- interprets String as a data constructor
> ''Maybe ''String -- wants to apply ''String to the Name type
I know I can workaround via using [t| Maybe String |]
, but this is then in the Q monad, and requires type changes, and I think is not type-checked at the respective moment, only when spliced in.
I can also work around by first defining a type alias, type MaybeString = Maybe String
, and then using ''MaybeString
, but this is also cumbersome.
Any way to directly get what I want simply via the ''
quotation?