Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting confused with MonadBaseControl errors while learning Conduits in Haskell
    primarykey
    data
    text
    <p>I'm trying go learn about Conduits in Haskell. It sounds interesting, but the types are quickly getting extremely confusing. </p> <p>I've got the following file written so far: <a href="https://gist.github.com/anonymous/7991727" rel="nofollow">https://gist.github.com/anonymous/7991727</a></p> <p>Presumably, what it would do is that, given a series of ticker symbols, it would go to Yahoo Finance and download the associated data file. Sounds simple enough.</p> <p><code>getLink</code> and <code>extractLink</code> works great. No problems there.</p> <p><code>downloadContent</code> is giving me all sorts of compile problems. This source code:</p> <pre><code>downloadContent manager = do mx &lt;- await case mx of Nothing -&gt; return () Just (sym, Nothing) -&gt; return () Just (sym, Just link) -&gt; do req &lt;- parseUrl link res &lt;- http req manager responseBody res $$+- sinkFile sym </code></pre> <p>The exact error I'm getting is this:</p> <pre><code>src/suckyahoo.hs:58:21: No instance for (MonadBaseControl IO (ConduitM [Char] ([Char], Maybe String) (ResourceT (ResourceT IO)))) arising from a use of `getLink' Possible fix: add an instance declaration for (MonadBaseControl IO (ConduitM [Char] ([Char], Maybe String) (ResourceT (ResourceT IO)))) In the second argument of `($=)', namely `getLink manager' In the first argument of `($$)', namely `sourceSyms $= getLink manager' In a stmt of a 'do' block: sourceSyms $= getLink manager $$ downloadContent manager src/suckyahoo.hs:58:40: No instance for (MonadBaseControl IO (ConduitM (FilePath, Maybe String) void-0.6.1:Data.Void.Void (ResourceT (ResourceT IO)))) arising from a use of `downloadContent' Possible fix: add an instance declaration for (MonadBaseControl IO (ConduitM (FilePath, Maybe String) void-0.6.1:Data.Void.Void (ResourceT (ResourceT IO)))) In the second argument of `($$)', namely `downloadContent manager' In a stmt of a 'do' block: sourceSyms $= getLink manager $$ downloadContent manager In the expression: do { sourceSyms $= getLink manager $$ downloadContent manager } Failed, modules loaded: none. </code></pre> <p>What is the insight here that will let me accomplish the intent of the code?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload