如何打印类型(字符串(IO字符串))? [英] How to print the type (Either String (IO String))?
本文介绍了如何打印类型(字符串(IO字符串))?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类型的情况。字符串(IO字符串)
。任何帮助?解决方案
解决方案是一个单线程....
print(print =<)
如果你想划分它是 Left
还是 Right
则需要更多介入,请参阅@ jamsihdh的答案。
请注意,这不能作为 Show
实例,因为对于类型 IO a
。
It's a very, very long story, and I won't bore you with it, but basically, I managed to get myself in a situation in which I need to be able to print the type Either String (IO String)
. Any help?
解决方案
The solution is a one liner....
either print (print =<<)
If you want to demarcate whether it was Left
or Right
it's a bit more involved, see @jamsihdh's answer.
Note that this cannot be made a Show
instance, since nothing can be purely observed about values of type IO a
.
这篇关于如何打印类型(字符串(IO字符串))?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文