Skip to content

Commit

Permalink
Minor corrections on test and the function of the class was removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Paulo Amorim committed Apr 15, 2016
1 parent 6c203d9 commit e49925d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion kaybe/src/main/java/com/jmonad/kaybe/Just.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.jmonad.kaybe

class Just<A>(value : A) : IMaybe<A> {
val value = value
override fun <B> bind(fn: (a : A) -> B): IMaybe<B> = Maybe().maybe(fn(value))
override fun <B> bind(fn: (a : A) -> B): IMaybe<B> = maybe(fn(value))
override fun fromJust(): A = value
override fun fromMaybe(def: A) = value
override fun isJust() = true
Expand Down
6 changes: 2 additions & 4 deletions kaybe/src/main/java/com/jmonad/kaybe/Maybe.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
package com.jmonad.kaybe

class Maybe {
fun <T> maybe(value : IMaybe<T>) : IMaybe<T> = value
fun <T> maybe(value : T) = if (value == null) Nothing<T>() else Just(value)
}
fun <T> maybe(value : IMaybe<T>) : IMaybe<T> = value
fun <T> maybe(value : T) = if (value == null) Nothing<T>() else Just(value)
4 changes: 1 addition & 3 deletions kaybe/src/test/java/com/jmonad/kaybe/MaybeTest.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.jmonad.kaybe

import org.junit.Test
import org.junit.Assert.assertEquals
import com.jmonad.kaybe.Maybe

class MaybeTest {

@Test fun testSample() {
// assert maybe("sample").fromMaybe("").equals("sample");
maybe(1).bind { }
}

}

0 comments on commit e49925d

Please sign in to comment.