Skip to content

Commit e6aba49

Browse files
committed
More succint use of Try.
1 parent ff3d19f commit e6aba49

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

src/main/scala/shapeless/TypeCheckingExercises.scala

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,10 @@ object TypeCheckingExercises extends FlatSpec with Matchers with exercise.Sectio
3333

3434
import shapeless.test.illTyped
3535

36-
val matchedTypes = Try {
37-
assertTypeError("illTyped { \"val a: Int = 1\" }")
38-
true
39-
} getOrElse {
40-
false
41-
}
36+
val matchedTypes = Try { assertTypeError("illTyped { \"val a: Int = 1\" }") }.isSuccess
4237
matchedTypes should be(res0)
4338

44-
val mismatchedTypes = Try {
45-
assertTypeError("illTyped { \"val a: String = 1\" }")
46-
true
47-
} getOrElse {
48-
false
49-
}
39+
val mismatchedTypes = Try { assertTypeError("illTyped { \"val a: String = 1\" }") }.isSuccess
5040
mismatchedTypes should be(res1)
5141
}
52-
5342
}

0 commit comments

Comments
 (0)