Skip to content

Make traverse lazy #513

@julien-truffaut

Description

@julien-truffaut

I believe we can make traverse lazy by using thunk or Eval in Applicative.map2 (please correct me if I am wrong)

def validate(i: Int): Option[Int] = if(i < 5) Some(i) else None

List(1,2,6,8).traverse(validate) // should not evaluate validate(8)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions