I'm a Haskell newbie, and I'm trying to get the wai package working (because I'm interested in using Haskell for web applications). I tried to start with the first, simplest example from the wai homepage:
[ 1] {-# LANGUAGE OverloadedStrings #-}
[ 2] import Network.Wai
[ 3] import Network.Wai.Enumerator (fromLBS)
[ 4] import Network.Wai.Handler.SimpleServer (run)
[ 5]
[ 6] app :: Application
[ 7] app _ = return Response
[ 8] { status = status200
[ 9] , responseHeaders = [("Content-Type", "text/plain")]
[10] , responseBody = ResponseLBS "Hello, Web!"
[11] }
[12]
[13] main :: IO ()
[14] main = do
[15] putStrLn $ "http://localhost:8080/"
[16] run 8080 app
When I run the code above (with runhaskell), I get the following error:
wapp.hs:10:36: No instance for (Data.String.IsString Data.ByteString.Lazy.Internal.ByteString) arising from the literal `"Hello, Web!"' at wapp.hs:10:36-48
Possible fix: add an instance declaration for (Data.String.IsString Data.ByteString.Lazy.Internal.ByteString)
In the first argument of ResponseLBS', namely
"Hello, Web!"'
In the `responseBody' field of a record
In the first argument of `return', namely
`Response
{status = status200,
responseHeaders = [("Content-Type", "text/plain")],
responseBody = ResponseLBS "Hello, Web!"}'
Is it something wrong with the example (I don't think so, because it's from the wai homepage - it should be correct!), or is it something wrong with my Haskell system?