-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from myeonginwoo/creatEither
Impl : Impl LeftProjection, RightProjection And TestCode
- Loading branch information
Showing
4 changed files
with
67 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main.kotlin | ||
|
||
/** | ||
* Created by Lazysoul on 2016. 12. 15.. | ||
*/ | ||
class LeftProjection<out L,out R>(val value: L) { | ||
|
||
val get: L get() = value | ||
|
||
fun <X> map(f: (L) -> X): LeftProjection<X, R> { | ||
return LeftProjection(f(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main.kotlin | ||
|
||
/** | ||
* Created by Lazysoul on 2016. 12. 15.. | ||
*/ | ||
class RightProjection<out L, out R>(val value: R) { | ||
|
||
val get: R get() = value | ||
|
||
fun <X : Any> map(f: (R) -> X): RightProjection<L, X> { | ||
return RightProjection(f(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters