File tree 2 files changed +8
-3
lines changed
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,11 @@ object blueSkyExtensions {
67
67
def map [B ](f : A => B ): This [B ]
68
68
}
69
69
70
+ // Generically, `pure[A]{.map(f)}^n`
71
+ def develop [A , F [X ] : Functor [X ]](n : Int , f : A => A ): F [A ] =
72
+ if (n == 0 ) Functor .static[F ].pure[A ]
73
+ else develop[A , F ](n - 1 , f).map(f)
74
+
70
75
trait Monad [A ] extends Functor [A ] {
71
76
static def pure [A ]: This [A ]
72
77
Original file line number Diff line number Diff line change @@ -15,17 +15,17 @@ object magnets {
15
15
16
16
object CompletionMagnet {
17
17
18
- extend (StatusCode , type T : Marshaller ) implements CompletionMagnet {
18
+ extend (StatusCode , type T : Marshaller ) : CompletionMagnet {
19
19
type Result = String
20
20
def apply (): String = implicitly[Marshaller [T ]].marshall(this ._2)
21
21
}
22
22
23
- extend Future [HttpResponse ] implements CompletionMagnet {
23
+ extend Future [HttpResponse ] : CompletionMagnet {
24
24
type Result = Int
25
25
def apply (): Int = 1
26
26
}
27
27
28
- extend Future [StatusCode ] implements CompletionMagnet {
28
+ extend Future [StatusCode ] : CompletionMagnet {
29
29
type Result = Int
30
30
def apply (): Int = 2
31
31
}
You can’t perform that action at this time.
0 commit comments