Conversation
…rade cats and scala-js.
beezee
reviewed
Sep 25, 2020
| def empty[A]: CursorHistory[A] = new CursorHistory(Vector(), None) | ||
| lazy val empty: CursorHistory = CursorHistory(Vector(), None) | ||
|
|
||
| implicit def eqCursorHistory[A]: Eq[CursorHistory[A]] = |
beezee
reviewed
Sep 25, 2020
| * @tparam NewValue The type of the new value | ||
| * @param NewFocus The type of the new focus | ||
| */ | ||
| final type Next[NewValue, NewFocus] = GCursor.AuxL[T, NewValue, NewFocus, Self] |
Contributor
There was a problem hiding this comment.
starting to look like profunctor optics
beezee
reviewed
Sep 25, 2020
| CursorHistory(history, Some(NonEmptyVector.of(failedOp))) | ||
|
|
||
| @inline final private def id[B](b: B): Id[B] = b | ||
| @inline final private def dup[B](b: B): Id[(B, B)] = (b, b) |
Contributor
There was a problem hiding this comment.
this is 1/2 monoid and 1/2 comonoid - worth thinking about b/c those are precursors to monad/comonad if you don't have either already
beezee
reviewed
Sep 25, 2020
|
|
||
| lazy val root: GCursor.Top[T] = self.root | ||
| lazy val focus: NewFocus = newFocus | ||
| lazy val last: Option[GCursor.AuxL[T, A, self.Focus, self.Last]] = Some(self) |
beezee
reviewed
Sep 25, 2020
| * @param ev Evidence that the current focus is a `(List[A], Int)` | ||
| * @see def moveList | ||
| */ | ||
| final def rightN(n: Int)(implicit ev: Focus =:= (List[A], Int)): Either[CursorHistory, Next[A, (List[A], Int)]] = |
Contributor
There was a problem hiding this comment.
looking like a zipper. comonad
beezee
reviewed
Sep 25, 2020
| * @param ev Evidence that the current focus is a `List[B]` | ||
| * @return A new cursor focused on the first element in the list, `None` if the list was empty | ||
| */ | ||
| final def downArray[B](implicit ev: A =:= List[B]): Either[CursorHistory, Next[B, (List[B], Int)]] = |
beezee
reviewed
Sep 25, 2020
Contributor
beezee
left a comment
There was a problem hiding this comment.
good to see you keeping forward motion, this is some rare-air code
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.