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 9210683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:08:02+00:00 2026-06-18T01:08:02+00:00

According to this topic: https://stackoverflow.com/questions/14494922/examples-of-websocket-usage-in-haskell I have my first question. Why official example of

  • 0

According to this topic: https://stackoverflow.com/questions/14494922/examples-of-websocket-usage-in-haskell I have my first question. Why official example of WebSockets library doesn’t run on my machine?

import Data.Char (isPunctuation, isSpace)
import Data.Monoid (mappend)
import Data.Text (Text)
import Control.Exception (fromException)
import Control.Monad (forM_, forever)
import Control.Concurrent (MVar, newMVar, modifyMVar_, readMVar)
import Control.Monad.IO.Class (liftIO)
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Network.WebSockets

meow :: TextProtocol p => WebSockets p ()
meow = forever $ do
    msg <- receiveData
    sendTextData $ msg `T.append` ", meow."

main :: IO ()
main = runServer "0.0.0.0" 8000 meow

I get:

ciembor@freedom ~> ghc hchat.hs; and ./hchat
[1 of 1] Compiling Main             ( hchat.hs, hchat.o )

hchat.hs:15:35:
    Couldn't match expected type `Text' with actual type `[Char]'
    In the second argument of `T.append', namely `", meow."'
    In the second argument of `($)', namely `msg `T.append` ", meow."'
    In a stmt of a 'do' block: sendTextData $ msg `T.append` ", meow."

hchat.hs:18:33:
    Couldn't match expected type `Request -> WebSockets p0 ()'
                with actual type `WebSockets p1 ()'
    In the third argument of `runServer', namely `meow'
    In the expression: runServer "0.0.0.0" 8000 meow
    In an equation for `main': main = runServer "0.0.0.0" 8000 meow
  • 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-18T01:08:03+00:00Added an answer on June 18, 2026 at 1:08 am

    The first error is because you didn’t enable the OverloadedStrings language extension. Without that, a "xyz" is a String, but Data.Text.append takes two Texts as arguments. Add

    {-# LANGUAGE OverloadedStrings #-}
    

    to the top of the module to fix that one.

    The second error is because the third argument to runServer must have type

    Request -> WebSockets p0 ()
    

    but you gave it a WebSockets p1 (). If you want to pass an action, you have to lift it to a function,

    main = runServer "0.0.0.0" 8000 $ const meow
    

    would compile (whether it would work [do what you want] is a question I cannot answer, that would just ignore all requests and always do the same thing).

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

Sidebar

Related Questions

According to this post: https://groups.google.com/forum/?fromgroups#!topic/kivy-users/n7c3thksnzg , it is possible to use Eclipse as an
this question is according to this topic: creating a huge dummy file in a
Problem is that i do all according this topic http://www.yiiframework.com/doc/guide/1.1/en/topics.error , but when in
I was practicing questions for this topic and I came across this question: Look
I have made a custom suface button according this example: <Button> <Button.Template> <ControlTemplate TargetType=Button>
How to turn it on? According to this http://docs.djangoproject.com/en/1.2/topics/i18n/internationalization/ I put into my template
According to http://gitster.livejournal.com/42247.html , branches can be either: topic branch = which contains all
i know i have posted a lot of questions on the same topic but
this is continuation of last successful topic jquery: percentage of two numbers First of
I'm new in the world of Node.js According to this topic: What is Node.js'

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.