Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facing error for importing _String from Data.Aeson.Lens

Tags:

haskell

import Data.Aeson.Lens (_String,key)
postRetweet1 tweetId = do
    tweetId >>= \tweetId1 -> (CM.foldM (\arr tid ->  ((try (postWith authenticate (retweetUrl++tid++".json") (DB.pack "ABC")) ):: IO (Either SomeException (Response BL.ByteString)) ) >>= 
         \sc ->
                case sc of
                    Right val ->   if (val ^. responseStatus ^. statusCode)==200
                                        then pure (arr++[val ^. responseBody . key "text" . _String ])  
                                    else pure (arr)     


                Left x -> pure (arr) ) [] tweetId1 )

this is the error im getting

Module ‘Data.Aeson.Lens’ does not export ‘_String’

i had referred this http://www.serpentine.com/wreq/tutorial.html

like image 237
Alexia Desouza Avatar asked Jan 28 '26 23:01

Alexia Desouza


1 Answers

You need to use lens-aeson package for _String

https://hackage.haskell.org/package/lens-aeson-1.0.2/docs/Data-Aeson-Lens.html

like image 164
Stanley Fernandes Avatar answered Feb 02 '26 02:02

Stanley Fernandes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!