Basic usage question: How do I satisfy a concrete...
# arrow
d
Basic usage question: How do I satisfy a concrete return type to
Kind<F, A>
? For instance, I have a
List<Animal>
but want to return
Kind<F, Animal>
. Example:
Copy code
interface AnimalMapper<F> : MonadError<F, Throwable> {

    fun Kind<F, FarmDto>.toAnimalsFromNetwork(): Kind<F, Animal> = flatMap { farmDto ->
        catch {
            farmDto.animalDtos.map {
                Animal(
                    it.id,
                    it.name
                )
            }
        }
    }
}
This yields a type inference error. Expected
Kind<F, Animal>
, but found
Kind<F, List<Animal>>
k
the easiest would be to convert it to the arrow
ListK
with the
.k()
ListK is the arrow List implementation and it is a
arrow.Kind<ForListK, A>