私はencode
(JSON経由で文字列へのHaskellタイプ)を使用します:
import GHC.Generics
import Data.Aeson
文字列は (コンパイラからのエラー メッセージによると): Data.ByteString.Lazy.Internal.ByteString
.
どうすればStrLnに入れられますか?
理論的に言えば
私が探しているのは、アドホックなポリモーフィックです。つまり、特定の文字列のような型のセマンティクスputStrLn
の適切なインスタンスを探しています。putStrLn
コンパイラ メッセージ
誰かが興味を持っている場合のコンパイラ メッセージ:
valencies.lhs:182:22:
Couldn't match type `Data.ByteString.Lazy.Internal.ByteString'
with `[Char]'
Expected type: String
Actual type: Data.ByteString.Lazy.Internal.ByteString
In the return type of a call of `encode'
In the first argument of `putStrLn', namely `(encode CALL)'
In the expression: putStrLn (encode CALL)
こちらもご覧ください
同様の質問ですが、タイプが少し異なります: How do I putStrLn a Data.ByteString.Internal.ByteString? .