I have a list of Text :
foo :: [Text]
foo = ["Foo", "Bar"]
I use scotty's json function to send the response.
post "/generate" $ do
json foo
I get No Instance Error:
No instance for (ToJSON Text) arising from a use of ‘json’
When I added :
instance ToJSON Text where
toJSON = String
instance FromJSON Text where
parseJSON = withText "Text" pure
I get :
Couldn't match type ‘text-1.1.1.3:Data.Text.Internal.Text’
with ‘Text’
NB: ‘text-1.1.1.3:Data.Text.Internal.Text’
is defined in ‘Data.Text.Internal’ in package ‘text-1.1.1.3’
‘Text’
is defined in ‘Data.Text.Internal.Lazy’ in package ‘text-1.2.0.0’
Expected type: Text -> Value
Actual type: text-1.1.1.3:Data.Text.Internal.Text -> Value
In the expression: String
In an equation for ‘toJSON’: toJSON = String
Seems like I have multiple versions of text-* installed, and I'm stuck.
Text, since those definitely already exist inData.Aeson. - bheklilr