Deprecate extension methods for List and ListK #82
Conversation
There was a problem hiding this 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
@Deprecated( | ||
"ListK is being deprecated, use the function defined for List instead.", | ||
ReplaceWith("List::class.head<A>()"), | ||
DeprecationLevel.WARNING) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>>> = |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @franciscodr !
No description provided.