Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foldable[T].traverse_ exercises accepts wrong answer as correct #62

Open
Fabs opened this issue Nov 12, 2017 · 1 comment
Open

Foldable[T].traverse_ exercises accepts wrong answer as correct #62

Fabs opened this issue Nov 12, 2017 · 1 comment

Comments

@Fabs
Copy link

Fabs commented Nov 12, 2017

On the exercise of Foldable traverse, it accepts a wrong answer as proper:

import cats.implicits._

def parseInt(s: String): Option[Int] =
  Either.catchOnly[NumberFormatException](s.toInt).toOption

Foldable[List].traverse_(List("1", "2", "3"))(parseInt) should be(Some(42))

Since traverse_ returns G[Unit], correct answer should be Some(()). But it is accepting Some of anything. Maybe it is even a bug on scalatest since on a workspace:

Foldable[List].traverse_(List("1", "2"))(parseInt) == Some(())
Foldable[List].traverse_(List("1", "2"))(parseInt) == Some(42)

Outputs:

true
false

image

@Fabs Fabs changed the title Foldable[T].traverse_ exercices Foldable[T].traverse_ exercises accepts wrong answer as correct Nov 12, 2017
@FRosner
Copy link
Member

FRosner commented Dec 19, 2017

This also applies to the last Traversable exercise:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants