So I started with Haskell recently and now I am learning Scotty to make simple web server.
I got this error which says reqHeader not in scope. I saw this code at different tutorials. Is something changed? Do I need to add any extra import?
Code
{-# LANGUAGE OverloadedStrings #-}
import Web.Scotty
import qualified Data.Text as T
import Control.Monad.IO.Class
import Network.HTTP.Types
main = scotty 3000 $ do
get "/" $ do
liftIO $ putStrLn $ "XXXXXXXXXXXXXXXXXXXXXX"
agent <- reqHeader "User-Agent"
text agent
Error log:
Resolving dependencies...
Configuring google-oauth-0.1.0.0...
Building google-oauth-0.1.0.0...
Failed to install google-oauth-0.1.0.0
Build log ( /home/shubh/.cabal/logs/google-oauth-0.1.0.0.log ):
cabal: Entering directory '.'
Configuring google-oauth-0.1.0.0...
Building google-oauth-0.1.0.0...
Preprocessing executable 'google-oauth' for google-oauth-0.1.0.0...
[1 of 1] Compiling Main ( src/Main.hs, dist/build/google-oauth/google-oauth-tmp/Main.o )
src/Main.hs:10:18: error:
• Variable not in scope:
reqHeader
:: [Char]
-> Web.Scotty.Internal.Types.ActionT
Data.Text.Internal.Lazy.Text IO Data.Text.Internal.Lazy.Text
• Perhaps you meant ‘setHeader’ (imported from Web.Scotty)
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
google-oauth-0.1.0.0 failed during the building phase. The exception was
So I started with Haskell recently and now I am learning Scotty to make simple web server. I got this error which says
reqHeader
not in scope. I saw this code at different tutorials. Is something changed? Do I need to add any extra import? CodeError log: