Skip to content

Commit 075c73e

Browse files
Alejandro Gómezraulraja
Alejandro Gómez
authored andcommitted
Don't include Sized section until we have exercises (#12)
1 parent 8837e68 commit 075c73e

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

src/main/scala/shapeless/ShapelessLib.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object ShapelessLib extends exercise.Library {
2323
LensesExercises,
2424
AutoTypeClassExercises,
2525
LazyExercises,
26-
SizedExercises,
26+
// SizedExercises,
2727
TypeSafeCastExercises,
2828
TypeCheckingExercises
2929
)

src/main/scala/shapeless/SizedExercises.scala

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ package shapelessex
33
import org.scalatest._
44
import shapeless._
55

6+
object SizedHelper {
7+
def row(cols: Seq[String]) =
8+
cols.mkString("\"", "\", \"", "\"")
9+
10+
def csv[N <: Nat](hdrs: Sized[Seq[String], N], rows: List[Sized[Seq[String], N]]) =
11+
row(hdrs) :: rows.map(row(_))
12+
13+
val hdrs = Sized("Title", "Author")
14+
15+
val rows = List(
16+
Sized("Types and Programming Languages", "Benjamin Pierce"),
17+
Sized("The Implementation of Functional Programming Languages", "Simon Peyton-Jones")
18+
)
19+
}
20+
21+
622
/** == Collections with statically known sizes ==
723
*
824
* shapeless provides collection types with statically known sizes. These can prevent runtime errors such as those that
@@ -27,23 +43,7 @@ import shapeless._
2743
* @param name sized
2844
*/
2945
object SizedExercises extends FlatSpec with Matchers with exercise.Section {
30-
31-
object Helper {
32-
def row(cols: Seq[String]) =
33-
cols.mkString("\"", "\", \"", "\"")
34-
35-
def csv[N <: Nat](hdrs: Sized[Seq[String], N], rows: List[Sized[Seq[String], N]]) =
36-
row(hdrs) :: rows.map(row(_))
37-
38-
val hdrs = Sized("Title", "Author")
39-
40-
val rows = List(
41-
Sized("Types and Programming Languages", "Benjamin Pierce"),
42-
Sized("The Implementation of Functional Programming Languages", "Simon Peyton-Jones")
43-
)
44-
}
45-
46-
import Helper._
46+
import SizedHelper._
4747

4848
/** In the example below we define a method `csv` whose signature guarantees at compile time that there are exactly as many
4949
* column headers provided as colums

0 commit comments

Comments
 (0)