This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Deprecated
Id<A>
data type (#94)
* Remove Id typeclass references * Remove Id tests
- Loading branch information
1 parent
ca1eac0
commit 9d7073b
Showing
8 changed files
with
25 additions
and
59 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
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
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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
package arrow.optics | ||
|
||
import arrow.core.Id | ||
import arrow.core.value | ||
import arrow.optics.typeclasses.Id | ||
|
||
/** | ||
* [PIso] that defines the equality between a [Id] wrapped type [A] and the type [A] itself. | ||
*/ | ||
fun <A, B> Id.Companion.toPValue(): PIso<Id<A>, Id<B>, A, B> = PIso( | ||
internal fun <A, B> Id.Companion.toPValue(): PIso<Id<A>, Id<B>, A, B> = PIso( | ||
get = Id<A>::value, | ||
reverseGet = ::Id | ||
) | ||
|
||
/** | ||
* [Iso] that defines the equality between a [Id] wrapped type [A] and the type [A] itself. | ||
*/ | ||
fun <A> Id.Companion.toValue(): Iso<Id<A>, A> = toPValue() | ||
internal fun <A> Id.Companion.toValue(): Iso<Id<A>, A> = toPValue() |
16 changes: 16 additions & 0 deletions
16
arrow-optics/src/main/kotlin/arrow/optics/typeclasses/internal.kt
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,16 @@ | ||
package arrow.optics.typeclasses | ||
|
||
import arrow.Kind | ||
import arrow.typeclasses.Applicative | ||
|
||
internal data class Id<out A>(val value: A) : Kind<Id.Companion, A> { | ||
internal companion object | ||
} | ||
|
||
internal fun <A> Kind<Id.Companion, A>.fix(): Id<A> = this as Id<A> | ||
|
||
internal object idApplicative : Applicative<Id.Companion> { | ||
override fun <A> just(a: A): Kind<Id.Companion, A> = Id(a) | ||
override fun <A, B> Kind<Id.Companion, A>.ap(ff: Kind<Id.Companion, (A) -> B>): Kind<Id.Companion, B> = | ||
Id(ff.fix().value(fix().value)) | ||
} |
4 changes: 2 additions & 2 deletions
4
arrow-optics/src/test/kotlin/arrow/optics/std/IdInstancesTest.kt
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