Haskell のコンジットについて学びに行こうとしています。面白そうに聞こえますが、型はすぐに非常に混乱します。
これまでに次のファイルを作成しました: https://gist.github.com/anonymous/7991727
おそらく、一連のティッカー シンボルが与えられると、Yahoo Finance にアクセスし、関連するデータ ファイルをダウンロードします。シンプルに聞こえます。
getLinkそしてextractLink素晴らしい作品。問題ありません。
downloadContentあらゆる種類のコンパイルの問題を私に与えています。このソースコード:
downloadContent manager = do
mx <- await
case mx of
Nothing -> return ()
Just (sym, Nothing) -> return ()
Just (sym, Just link) -> do
req <- parseUrl link
res <- http req manager
responseBody res $$+- sinkFile sym
私が得ている正確なエラーはこれです:
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.
コードの意図を達成するためのここでの洞察は何ですか?