如何检查客户?
case e of
Just e -> let client = (e, sink)
Nothing -> let client = false
case msg of
_ | not client -> do nothing
| msg -> do something
| otherwise -> do print "i was born in..."
可能甚至没有关闭,但希望它清楚我想要做什么。
如何检查客户?
case e of
Just e -> let client = (e, sink)
Nothing -> let client = false
case msg of
_ | not client -> do nothing
| msg -> do something
| otherwise -> do print "i was born in..."
可能甚至没有关闭,但希望它清楚我想要做什么。
我想你正在寻找这样的东西:
m e sink = do
case e of
Nothing -> print "No Client"
(Just c) -> do
-- Client is in c
如果不是,我们真的需要更多代码和描述来说明您正在尝试做什么。
否则,我必须告诉你,你似乎在 Haskell 中做一些必要的事情。你应该回去阅读一些教程,比如Learn You A Haskell和Real World Haskell。尤其是后者包含了大量关于实际 Haskell 程序的 Haskell 应用示例。