我有这个有效的管道表达式:
main1 = runResourceT
$ CB.sourceHandle stdin
$$ CB.lines
=$ Cl.concatMap matches
=$ Cl.mapMaybe readDouble
=$ Cl.map fst
=$ Cl.map bucket
=$ Cl.map (BS.pack . show)
=$ Cl.map (\x -> x <> BS.pack "\n")
=$ CB.sinkHandle stdout
我无法将它分成两部分,即:
source = CB.sourceHandle stdin
$$ CB.lines
=$ Cl.concatMap matches
=$ Cl.mapMaybe readDouble
=$ Cl.map fst
=$ Cl.map bucket
sink = Cl.map (BS.pack . show)
=$ Cl.map (\x -> x <> BS.pack "\n")
=$ CB.sinkHandle stdout
这样我就可以使用:
runResourceT $ source =$ sink
或者其他什么......我从类型检查器得到的错误信息有些难以理解。