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

  • Home
  • SEARCH
  • 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 8914769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:48:33+00:00 2026-06-15T04:48:33+00:00

I am trying Yesod book examples documented on Yesod webpage. One of the examples

  • 0

I am trying Yesod book examples documented on Yesod webpage. One of the examples is for Chat application embedded in Wiki. When I try it in ghci (loading Chat module from Wiki.hs which contains Wiki example code), I get the error below for Chat.hs:

Chat.hs:122:34:
    Could not deduce (Text.Julius.ToJavascript Text)
      arising from a use of `Text.Julius.toJavascript'
    from the context (YesodChat master)
      bound by the type signature for
                 chatWidget :: YesodChat master =>
                               (Route Chat -> Route master) -> GWidget sub master ()
      at Chat.hs:(81,15)-(83,35)
    Possible fix:
      add an instance declaration for (Text.Julius.ToJavascript Text)
    In the first argument of `Text.Julius.Javascript', namely
      `Text.Julius.toJavascript output'
    In the expression:
      Text.Julius.Javascript (Text.Julius.toJavascript output)
    In the first argument of `Data.Monoid.mconcat', namely
      `[Text.Julius.Javascript
          ((Data.Text.Lazy.Builder.fromText . Text.Shakespeare.pack')
             "\
             \// Set up the receiving end\
             \var output = document.getElementById(\""),
        Text.Julius.Javascript (Text.Julius.toJavascript output),
        Text.Julius.Javascript
          ((Data.Text.Lazy.Builder.fromText . Text.Shakespeare.pack')
             "\");\
             \var src = new EventSource(\""),
        Text.Julius.Javascript
          (Data.Text.Lazy.Builder.fromText
             (_render_a3Yr (toMaster ReceiveR) [])),
        ....]'

I am not very familiar with Yesod libraries yet. So, I am stumped by the above error – I have seen this error in other Yesod examples too where toWidget function is called. So, it seems to be related to toWidget function. I will appreciate help in fixing the above error.

I am using ghc 7.6.1 with yesod 1.1.4.1.

Update:

Fixed following Hammar’s suggestion. I made two changes in Chat.hs.

  1. Add import statement for rawJS:

    import Text.Julius (rawJS)

  2. Track down all instances of #{} blocks within julius whamlet in Chat.hs, and replace them with {# rawJS ...}

    var output = document.getElementById("#{rawJS output}");

    var input = document.getElementById("#{rawJS input}");

  • 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-15T04:48:34+00:00Added an answer on June 15, 2026 at 4:48 am

    I don’t have Yesod installed to test it at the moment, but according to this blog post you should just have to change #{output} to #{rawJS output} and so on when interpolating JavaScript identifiers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to install my Yesod web app on another machine. I have
Trying to randomly generate one div from an array on each load of a
Trying to get a working directfb for use in an embedded system based on
I am trying to upgrade my Yesod project to version 1.1 and it was
I've been trying to setup keter for my yesod website, but I'm running into
Haskell and Yesod newbie here. I've been trying to follow the Integration with Yesod
Hi I'm very new to yesod and I'm trying to follow this Tutorial but
Trying to learn asio, and I'm following the examples from the website. Why is
I am trying to cabal install yesod on my Windows machine. I have a
Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however

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.