我有一个管道表达式,它有效:
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
或者其他什么。。。我从类型检查器中得到的错误消息有些不可思议。