Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:42:22+00:00 2026-06-15T05:42:22+00:00

this is probably a simple question and I’ve seen a similar one on SO,

  • 0

this is probably a simple question and I’ve seen a similar one on SO, but I’m still stuck.

I’m trying to do an HTTP call to pull in the contents of another blog and display it on my page. This is more of a learning exercise than anything.

Here’s my handler

blog :: App1Handler ()
blog = do
  contents <- Requester.getUrl "http://someblog.com/"
  heistLocal (bindString "contents" contents) . render $ "blog"

Requester.getUrl has the signature getUrl :: String -> IO T.Text

And the error I get back is

src/Main.hs:50:15:
Couldn’t match expected type Handler App1 App1 t0' with actual typeIO T.Text’
In the return type of a call of `getUrl’
In a stmt of a ‘do’ block:
contents <- getUrl “http://someblog.com/&#8221;
In the expression:
do { contents <- getUrl “http://someblog.com/&#8221;;
heistLocal (bindString “contents” contents) . render $ “blog” }

From what I gather, I’m stuck inside of the IO monad and it wants the type Handler App1 App1 t0. I’ve experimented with sticking liftIO in places, but I’m pretty confused on this one.

Can anyone point me in the right direction?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:42:23+00:00Added an answer on June 15, 2026 at 5:42 am

    You just have to liftIO the IO action returned by getUrl, like this:

    contents <- liftIO $ Requester.getUrl "http://someblog.com/"
    

    The reasoning here is simple. You have a do-block of type App1Handler (), which means that the
    right hand side of any <- statement within this do-block must have type App1Handler a.

    However, getUrl returns IO Text, so you need to a function to convert from
    IO a to App1Handler a which is exactly what liftIO does.

    liftIO :: MonadIO m => IO a -> m a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this is probably a simple question, but I'm still trying to figure
This is probably a really simple question but one I've never quite worked out
This is probably a simple question, but I'm trying to lookup the constant name
This is probably one very simple question to answer, but I can't output the
This is probably a simple question but I'm having a hard time trying to
This is probably a simple question but I can't seem to figure out how
This is probably a simple question, but i have been unable to find a
This is probably a simple question but I am developing a web app in
This is probably a very simple question so please forgive my ignorance, but can
This is probably a very simple question but I'm a little confused how this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.