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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:53:39+00:00 2026-05-27T13:53:39+00:00

I have the basic hello world application setup using wai, and would like to

  • 0

I have the basic “hello world” application setup using wai, and would like to use wai-handler-devel, but am unsure how to go about it and can’t find any examples of it in usage on a wai project.

{-# LANGUAGE OverloadedStrings #-}
import Network.Wai
import Network.HTTP.Types
import Network.Wai.Handler.Warp (run)
import Data.ByteString.Lazy.Char8 () -- Just for an orphan instance

app :: Application
app _ = return $ responseLBS
    status200
    [("Content-Type", "text/plain")]
    "Hello, World!"

main :: IO ()
main = do
    putStrLn $ "http://localhost:8080/"
    run 8080 app

What do I need to do to get wai-handler-devel working with a basic wai app?

Note:
There is a fix here ( https://gist.github.com/1499226) i f you run into issues with “wai-handler-devel: command not found”

  • 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-05-27T13:53:40+00:00Added an answer on May 27, 2026 at 1:53 pm

    wai-handler-devel’s Hackage page says that it should be invoked from the command-line like so:

    $ wai-handler-devel <port> My.App.Module myApp
    

    and that your application’s type must look like this:

    myApp :: (Application -> IO ()) -> IO ()
    

    In this case, you should define myApp as follows:

    myApp :: (Application -> IO ()) -> IO ()
    myApp handler = handler app
    

    although you may want to inline app entirely:

    myApp :: (Application -> IO ()) -> IO ()
    myApp handler = handler $ \_ -> return $ responseLBS
        status200
        [("Content-Type", "text/plain")]
        "Hello, World!"
    

    The type is like this so that you can do initialisation on start-up and the like in IO. I suggest reading the SmallApp and FullApp examples from wai-handler-devel’s git repository; the latter is especially helpful, as it has debug output showing the flow of the code during a reload, and shows how to integrate a long-running database connection.

    The run script for the FullApp example also shows how to use wai-handler-devel programmatically, including manually specifying Hamlet template dependencies (which the wai-handler-devel command-line tool determines automatically).

    You should then be able to rewrite your main as follows:

    main :: IO ()
    main = do
        putStrLn $ "http://localhost:8080/"
        myApp (run 8080)
    

    Of course, you could just as easily pass the run function from wai-handler-fastcgi, wai-handler-scgi or even wai-handler-webkit.

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

Sidebar

Related Questions

I have created a very basic Hello world application where I am trying to
I have picked a basic example of printing Hello World on screen when the
i have the basic webserver hello world app for nodejs on windows and it
Dup of Some Basic PHP Questions Hello, I have a heap of tinyint fields
Currently, i have basic C++ and PHP skills. But, i want to switch to
I have a basic understanding of mock and fake objects, but I'm not sure
I have a basic cs-major understanding of multi-threading but have never had to do
I have a basic C# console application that reads a text file (CSV format)
We have an application that is built with Excel as the front end using
In my current company, we have this decade old...let's call it a Hello World

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.