I would like to input a string from the console and output a JSON string.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Data.Aeson
import Data.Map.Strict
main :: IO ()
main = interact $ encode
This code fails. Of course, I see encode
has type ToJSON a => a -> Data.ByteString.Lazy.Internal.ByteString
and interact'
takes String -> String
, but that's the reason I'm using OverloadedStrings
.
How can I solve this problem ? Perform a cast to String
?