To print the value of a type in Haskell, the type must be an instance of the Show class.
localeEncoding :: TextEncoding
and TextEncoding is not an instance of Show.
The TextEncoding type is actually an existential type that stores encoding and decoding methods:
data TextEncoding = forall dstate estate . TextEncoding { mkTextDecoder :: IO (TextDecoder dstate), mkTextEncoder :: IO (TextEncoder estate) }
Since these are functions, there is no reasonable way to show them. The current localeEncoding is determined using iconv through the C function nl_langinfo.
So, TextEncoding as such is not a visible type, so you cannot print it. However, you can create new values โโof this type through mkTextEncoding. For instance. to create utf8 environment:
mkTextEncoding "UTF-8"
We might consider requesting a function to store a language representation using TextEncoding so that this shortcut can be printed. However, this is currently not possible.
source share