Skip to content

Commit 8837e68

Browse files
Alejandro Gómezraulraja
Alejandro Gómez
authored andcommitted
Fix link (#11)
1 parent aff8108 commit 8837e68

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/main/scala/shapeless/GenericExercises.scala

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

6+
object GenericHelper {
7+
case class Foo(i: Int, s: String, b: Boolean)
8+
9+
val fooGen = Generic[Foo]
10+
11+
val foo = Foo(23, "foo", true)
12+
13+
import poly._
14+
15+
// Simple recursive case class family
16+
sealed trait Tree[T]
17+
case class Leaf[T](t: T) extends Tree[T]
18+
case class Node[T](left: Tree[T], right: Tree[T]) extends Tree[T]
19+
20+
// Polymorphic function which adds 1 to any Int and is the identity
21+
// on all other values
22+
// format: OFF
23+
object inc extends -> ((i: Int) i + 1)
24+
// format: ON
25+
case class Book(author: String, title: String, id: Int, price: Double)
26+
case class ExtendedBook(author: String, title: String, id: Int, price: Double, inPrint: Boolean)
27+
}
28+
29+
630
/** == Generic representation of (sealed families of) case classes ==
731
*
832
* The `Iso`s of earlier shapeless releases have been completely reworked as the new `Generic` type, which closely
9-
* resembles the [generic programming capabilities introduced to GHC 7.2][ghcgeneric].
33+
* resembles the [[https://wiki.haskell.org/GHC.Generics generic programming capabilities introduced to GHC 7.2]].
1034
*
1135
* `Generic[T]`, where `T` is a case class or an abstract type at the root of a case class hierarchy, maps between values
1236
* of `T` and a generic sum of products representation (`HList`s and `Coproduct`s),
1337
*
1438
* @param name generic
1539
*/
1640
object GenericExercises extends FlatSpec with Matchers with exercise.Section {
41+
import GenericHelper._
1742

18-
case class Foo(i: Int, s: String, b: Boolean)
19-
20-
object Helper {
21-
22-
val fooGen = Generic[Foo]
23-
24-
val foo = Foo(23, "foo", true)
25-
26-
import poly._
27-
28-
// Simple recursive case class family
29-
sealed trait Tree[T]
30-
case class Leaf[T](t: T) extends Tree[T]
31-
case class Node[T](left: Tree[T], right: Tree[T]) extends Tree[T]
32-
33-
// Polymorphic function which adds 1 to any Int and is the identity
34-
// on all other values
35-
// format: OFF
36-
object inc extends -> ((i: Int) i + 1)
37-
// format: ON
38-
case class Book(author: String, title: String, id: Int, price: Double)
39-
case class ExtendedBook(author: String, title: String, id: Int, price: Double, inPrint: Boolean)
40-
}
41-
42-
import Helper._
4343
/** {{{
4444
* case class Foo(i: Int, s: String, b: Boolean)
4545
*

0 commit comments

Comments
 (0)