Reputation: 4045
The result of Text.Printf is a variable of type PrintfType.
Is there a way to convert this result to String?
I want something like that: convertToString :: PrintfType -> String
I've searched everywhere but I can't find anything.
Upvotes: 0
Views: 179
Reputation: 64740
The result of Text.Printf is a variable of type PrintfType.
No. PrintfType
is a constraint on the type, not a type itself. Notice the instances of PrintfType
provided by module Text.Printf
are:
IsChar c => PrintfType [c]
(~) * a () => PrintfType (IO a)
(PrintfArg a, PrintfType r) => PrintfType (a -> r)
Is there a way to convert this result to String?
No conversion necessary, String ~ [Char]
and there exists an instance IsChar Char
. Thus, the constraint of PrintfType String
is satisfied.
I want something like that: convertToString :: PrintfType -> String
That makes no sense since you're using PrintfType
as a Type instead of a constraint.
Upvotes: 4