Question

I am new to haskell and am creating an RSS feed of all the blogs/sites i follow to make like a news feed, however i have hit a snag.

rssFeed :: Snap ()
rssFeed = 
    feed <- parseFeedString "https://news.ycombinator.com/rss"
    putStrLn (ppTopElement $ xmlFeed feed)

this is the main function creating the feed, but when compiling i get back this error

Resolving dependencies...
Configuring feedre-0.1...
Building feedre-0.1...
Preprocessing executable 'feedre' for feedre-0.1...
[1 of 1] Compiling Main             ( src/Main.hs, dist/build/feedre/feedre-tmp/Main.o )

src/Main.hs:26:14: parse error on input `<-'
Failed to install feedre-0.1
cabal: Error: some packages failed to install:
feedre-0.1 failed during the building phase. The exception was:
ExitFailure 1

No correct solution

OTHER TIPS

I think you are only missing a do:

rssFeed :: Snap ()
rssFeed = do
    feed <- parseFeedString "https://news.ycombinator.com/rss"
    putStrLn (ppTopElement $ xmlFeed feed)

because the <- comes from do-notation.

I don't know how the Snap monad looks, but I guess you might need a liftIO for the putStrLn:

liftIO $ putStrLn (ppTopElement $ xmlFeed feed)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top