给定一个简单的 JSON 类型示例:
data Test = Test
{ name :: Text
, age :: Int
} deriving (Show, Generic)
instance FromJSON Test
如何使用管道 aeson 解码使用decoded
镜头通过套接字传来的 JSON 消息流?作为一个例子,我想在解析它们时将它们打印出来:
main = connect "127.0.0.1" "8000" $ \(socket, _) -> $ runEffect $
some use of zoom decoded? view decoded? >-> P.print