Jakub Pi
03/03/2020, 8:17 PMList<Either<Throwable, C>>
to a List<C>
so that I can pass the cleaned up values to a function. I have a solution but it looks ugly, is there a more idiomatic way? Also welcome comments about approach. Underlying motivation is to start with unvalidated inputs and then only forward the parsed and validated values down to the domain layer which does not have side effects. I will log/handle errors in the next iteration.
.fold(listOf<C>(), {acc, e -> (e.fold({null}, {it})).let {if (it!=null) acc + it else acc}})
Jannis
03/03/2020, 8:21 PMfilterMap { it.toOption() }
should also work^^Jakub Pi
03/03/2020, 8:32 PMJannis
03/03/2020, 8:42 PMFunctorFilter
. We plan on creating a ide plugin and search engine similar to haskell hoogle so that you can search for type signatures. But even that won't find a signature like that. Searching for something like filter
on the docs might have found it though. I know most things by heart so I don't usually try those things ^^Bob Glamm
03/03/2020, 9:39 PM