Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

tut:fail is failing #57

Open
wheaties opened this issue Jul 12, 2015 · 4 comments
Open

tut:fail is failing #57

wheaties opened this issue Jul 12, 2015 · 4 comments
Milestone

Comments

@wheaties
Copy link

The following code taken verbatim from some documentation I'm trying to tut:fail

import concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global

def something[A](futL: Future[List[Int]])(f: Int => A): Future[List[A]] = for{
  list <- futL
  item <- list //won't compile since "list" isn't a Future and hence, doesn't compose!
} yield f(item)

gives me the following output:

[tut] *** Error reported at Transformers.md:17: failure was asserted but no failure occurred
import concurrent.Future
[tut] *** Error reported at Transformers.md:18: failure was asserted but no failure occurred
import scala.concurrent.ExecutionContext.Implicits.global

I'm assuming this is a bug or is it supposed to be overeager? Removing the :fail causes the expected compilation errors.

@tpolecat
Copy link
Owner

Ah, yeah. Hell. The way it's written fail expects every statement in the block to fail. My tests were all examples with a single expression. For now you can fix it by breaking it into two blocks.

@tpolecat tpolecat added this to the v0.4.1 milestone Jul 12, 2015
@tpolecat tpolecat modified the milestones: v0.4.1, v0.4.2 Jan 3, 2016
@wheaties
Copy link
Author

I see there's a :paste option, could that be combined with :fail to, in essence, get the desired result? If so, can close issue.

@tpolecat
Copy link
Owner

Yes, good point. I think so, but let's leave this open for now.

@tpolecat
Copy link
Owner

To be clear there is not yet a :paste option.

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

No branches or pull requests

2 participants