【发布时间】:2021-03-26 09:33:20
【问题描述】:
我有一个类型为 Either 的项目列表:
[Right [(a, b)], Right [(a1, b1)], Right [(a2, b2)]] 我想得到Right [(a,b), (a1, b1), (a2, b2)],可以吗?
我正在使用序列来执行此操作,但我得到:
Right [[(a,b)], [(a1, b1)], [(a2, b2)]]。我想知道,是否有像 concat 这样的函数可以去掉这些内括号,使其只是一个元组列表。
【问题讨论】:
-
concat <$> sequence yourlist.