Aeson - Haskell

Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.

Vincent L

I have an issue with Aeson,

/mnt/c/Users/vljno/Source/Repos/pursssscript2/app/Main.hs:21:88: error:
    Not in scope: ‘Aeson.encodeToLazyText’
    Module ‘Data.Aeson’ does not export ‘encodeToLazyText’.
   |
21 |   _ <- writeFile "/mnt/c/Users/vljno/Source/Repos/pursssscript2/app/res.json" $ show $ Aeson.encodeToLazyText  $ ToExportCtor parsedData
   |
Vincent L

I see that Aeson.encode exports a bytestring, and writeFile takes a String

TheMatten

Is it imported qualified as Aeson? Because you're calling it that way

TheMatten

BTW, I would probably use bytestring's writeFile instead of going through 2 string types

Vincent L

TheMatten said:

Is it imported qualified as Aeson? Because you're calling it that way

ho yes right I used the wrong qualified import

Vincent L

When I export something I have \" instead of just "

TheMatten

You are using show on string datatype - show is meant for printing values as written in source, not for serialization - it's actually completely redundant here as long as you pick correct writeFile