Hiroto
そうなんですよー。でもやろうとするといくつかの関数でリストを期待してるのに実際はTextだよってエラーが出るんです
takeWhile みたいな物ですね http://hackage.haskell.org/package/attoparsec-0.13.2.2/docs/Data-Attoparsec-Text.htmltakeWhile みたいなTextに特化したコンビネータを使うとattoparsecが速いよ(意訳)」みたいな事が書いてあるので、parsecでリストを経由しない手段は恐らく無さそう
<no location info>: error:
Warning: Couldn't figure out C compiler information!
Make sure you're using GNU gcc, or clang
Preprocessing library for Yampa-0.11..
Building library for Yampa-0.11..
`gcc.exe' failed in phase `C pre-processor'. (Exit code: 1)
stack build --verbose したらどうなるのか気になります。HTML内で使う
"Error in $: When parsing the record Message of type Web.Slack.Common.Message the key type was not present."
scala> parser.decode[User]("""{"id":1, "name_fuga":"taro"}""")
//res96: cats.data.Xor[io.circe.Error,User] = Left(io.circe.DecodingFailure: Attempt to decode value on failed cursor: El(DownField(name),false))
"Error in $: When parsing the record Message of type Web.Slack.Common.Message the key type was not present."type というキーがJSONに含まれてないものと読めます。test.json を作って試したところ、同じメッセージを再現できたので、 「 type というキーがない」というエラーで間違いないと思います。
{
"ts": "1541835316.110000",
"text": "test",
"user": "U4L0B71L1"
}
stack exec ghci :m + Web.Slack.Common Data.Aeson eitherDecodeFileStrict "test.json" :: IO (Either String Message)