cats-effect:如何将“ List [IO [A]]”转换为“ IO [List [A]]”

时间:2018-07-05 13:19:19

标签: io monads scala-cats

我有一个override func layoutSubviews() { super.layoutSubviews() if isGradientAdded { gradientView.layer.sublayers?.first?.frame = self.bounds } } ,我想将其转换为'================================================================ 'Button on MASTER sheet 'Functions: inputs new digsafe data into LIST sheet '================================================================ Sub add_to_list() Dim wsMaster As Worksheet: Set wsMaster = Worksheets("MASTER") Dim wsList As Worksheet: Set wsList = Worksheets("LIST") Dim table_list_object As ListObject: Set table_list_object = wsList.ListObjects("Table1") Dim table_object_row As ListRow: Set table_object_row = table_list_object.ListRows.Add Dim digsafe As Long Dim workType As String, crossStreet As String, address As String Dim dateTime As Date digsafe = wsMaster.Range("C5").Value 'Stores values inputted by user dateTime = wsMaster.Range("C6").Value workType = wsMaster.Range("C7").Value crossStreet = wsMaster.Range("C8").Value address = wsMaster.Range("C9").Value wsList.Activate table_object_row.Range(1, 1).Value = digsafe 'Inputs data at end of the table (Table1) table_object_row.Range(1, 2).Value = dateTime table_object_row.Range(1, 3).Value = workType table_object_row.Range(1, 4).Value = crossStreet table_object_row.Range(1, 5).Value = address For Each Cell In wsMaster.Range("C5:C9") 'Clears data from DS Input after entered Cell.Value = "" Next End Sub 在scalaz中,我会使用List[IO[A]],但在猫中却找不到类似的东西

1 个答案:

答案 0 :(得分:0)

这解决了我的问题

import cats.implicits._

val x: List[IO[A]] = ...
val y: IO[List[A]] = x.sequence