You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2023. It is now read-only.
{-# LANGUAGE OverloadedStrings #-}
importRedditimportReddit.Types.PostimportControl.MonadimportControl.Monad.IO.ClassimportData.MonoidimportqualifiedData.TextasTextimportqualifiedData.Text.IOasText
main = runRedditAnon $doListing _ _ posts <- getPosts
forM_ posts $\post ->do
liftIO $Text.putStrLn$"["<> tshow (score post) <>"] "<>
title post <>" ("<> tshow (subreddit post) <>")"
tshow =Text.pack .show
fails to compile:
• Couldn't match expected type ‘Integer’
with actual type ‘SubredditName’
• In the first argument of ‘tshow’, namely ‘(subreddit post)’
In the first argument of ‘(<>)’, namely ‘tshow (subreddit post)’
In the second argument of ‘(<>)’, namely
‘tshow (subreddit post) <> ")"’
|
23 | title post <> " (" <> tshow (subreddit post) <> ")"
| ^^^^^^^^^^^^^^
Example from readme:
{-# LANGUAGE OverloadedStrings #-} import Reddit import Reddit.Types.Post import Control.Monad import Control.Monad.IO.Class import Data.Monoid import qualified Data.Text as Text import qualified Data.Text.IO as Text main = runRedditAnon $ do Listing _ _ posts <- getPosts forM_ posts $ \post -> do liftIO $ Text.putStrLn $ "[" <> tshow (score post) <> "] " <> title post <> " (" <> tshow (subreddit post) <> ")" tshow = Text.pack . showfails to compile:
Adding signature to tshow fixed it for me: