I am aware that there is a GHC extension, OverloadedStrings, which allows string literals (delimited by ") to become polymorphic, similar to the built-in behavior for number literals.
My question is: is there a GHC extension that allows single character literals (delimited by ') to become polymorphic in an analogous way?
Not as of GHC 8.8, but you can use the
QuasiQuotesextension to get pretty far. Here is an example of a quasiquote which only accepts an ascii character and converts it to its byte representation.Then, you can use it as: