Skip to content
This repository has been archived by the owner on Feb 24, 2021. It is now read-only.

Deprecate extension methods for List and ListK #82

Merged
merged 15 commits into from Jan 12, 2021

Conversation

franciscodr
Copy link
Contributor

No description provided.

@franciscodr franciscodr requested a review from a team January 11, 2021 11:54
Copy link
Member

@nomisRev nomisRev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks @franciscodr

@nomisRev nomisRev requested a review from a team January 11, 2021 13:04
@Deprecated(
"ListK is being deprecated, use the function defined for List instead.",
ReplaceWith("List::class.head<A>()"),
DeprecationLevel.WARNING)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raulraja @nomisRev What about this function? Should we keep List class as the receiver? Or should we use the Optional companion to project the function as Optional.listHead<A>()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are issues we'll only encounter in Optics afaik and it's unrelated to the typeclasses. We have the same issue in all other types, for example TupleN since these are just top-level APIs for Optics. Similar to emptyList<A>() and listOf(1, 2, 3) etc in Kotlin.

So we can either follow the Kotlin Std pattern of putting this simply as top-level functions, or we follow Paco's suggestion of Optional.listHead<A>() which I like better to be honest.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional companion option sounds good 👍

/**
* [PIso] that defines equality between a [List] and [Option] [NonEmptyList]
*/
fun <A, B> KClass<List<*>>.toPOptionNel(): PIso<List<A>, List<B>, Option<NonEmptyList<A>>, Option<NonEmptyList<B>>> =
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. It could be created as PIso.listToPOptionNel

Copy link
Member

@raulraja raulraja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @franciscodr !

@franciscodr franciscodr merged commit b13f3aa into master Jan 12, 2021
@franciscodr franciscodr deleted the paco-deprecate-extensions-list branch January 12, 2021 22:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants