Yesod tutorial compile error: Not in scope: ‘runResourceT’ - haskell

experts
I'm following the Yesod tutorial on fpcomplete (part 3) https://www.fpcomplete.com/school/advanced-haskell/building-a-file-hosting-service-in-yesod/part%203, but got stuck.
When I compile the project, got this error: Handler/Home.hs:29:26: Not in scope: ‘runResourceT’
I'm using GHC 7.8 and the Stackage build: http://www.stackage.org/stackage/cd04dd6aad3aa5f097598adc050e4f02e571adbc
Did something changed about runResourceT in 7.8? I'm a newbie to Haskell, and not familar with the libraries.
Thanks a lot in advance!
Regards,
Terry

I think that an older version of Data.Conduit might have exported ResourceT directly, but nowadays you need to import it explicitly with
import Control.Monad.Trans.Resource

Related

Haskell Language Server in VS code shows 'could not find module' Error

I have the following imports in my file
import Control.Applicative (Applicative(liftA2))
import Control.Monad ( guard )
import qualified Data.Vector as V
and I get the error that reads could not find module 'Data.Vector'
The module is installed. I have vector in dependencies and the program builds fine. I just can't get rid of the error in VS Code.
What extra installations do I have to do to fix this?
I have tried:
cabal install vector --lib
Have you tried?
cabal install vector --lib

Importing documentCreateElement function from Webkit

I am trying to import documentGetElementById function for use in Reflex FRP. I tried the import below but can't find the function (which according to hackage should be there):
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
[1 of 1] Compiling Main ( Test.hs, interpreted )
Ok, modules loaded: Main.
*Main> import Graphics.UI.Gtk.WebKit.DOM.Document
*Main Graphics.UI.Gtk.WebKit.DOM.Document> :t documentGetElementById
<interactive>:1:1: error:
Variable not in scope: documentGetElementById
I will appreciate help with resolving this. I am running latest Reflex platform build with ghc 8.0.1 on mac where webkit works now. I see the same problem on Linux as well. So, it doesn't seem to be platform-specific.
I also did github code search on ghcjs-dom but documentGetElementById doesn't show up. So, perhaps it has been moved somewhere else?
documentGetElementById has been renamed to getElementById after ghcjs-dom refactoring. So, an import like below would work:
*Main> import Graphics.UI.Gtk.WebKit.DOM.Document
*Main Graphics.UI.Gtk.WebKit.DOM.Document> :t getElementById
getElementById
:: (DocumentClass self, System.Glib.UTFString.GlibString string,
MonadIO m) =>
self -> string -> m (Maybe Graphics.UI.Gtk.WebKit.Types.Element)

How can I use module Control.Monad.Free in Haskell?

I try code in Haskell. I want to use module Control.Monad.Free. I written import Control.Monad.Free in my test.hs. But I have error:
How can I fix this error?
Control.Monad.Free is defined in the free package. You can install it with Cabal:
cabal install free

Haskell Import MissingH

I'm trying to import the Data.String.Utils module in my Haskell code, this is part of the MissingH package. I've installed cabal and used it to acquire MissingH, which is properly installed. However, wehn I try adding
import Data.String.Utils
to my code, WinHugs returns
ERROR file:.\ex.hs - Can't find imported module "Data.String.Utils"
Any feedback?
You already have MissingH installed with Cabal.
Using Cabal packages with WinHugs is hit and miss.
Use ghci and import Data.String.Utils should work.

Import monad state

I'm trying to import the monad State.
I did the following command:
:m Control.Monad.State
But the module cannot be found. I'm using GHCi, version 7.0.4:.
Can you give me some hint to fix the problem?
Thank you.
You're missing the mtl package.
You can either install it from Hackage yourself; or install the Haskell Platform, which comes with the necessary libraries.

Resources