如何打印类型(字符串(IO字符串))? [英] How to print the type (Either String (IO String))?

查看:133
本文介绍了如何打印类型(字符串(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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆