Created
May 3, 2023 03:51
-
-
Save julianpeeters/9e02d0342db41d286f91e02f24617b7a to your computer and use it in GitHub Desktop.
Example of the inability of Store to form a Representable (yet is itself a sum of representables)
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
// Unable to implement `tabulate` without a value to provide as the index | |
implicit def representableForStore[S]: Representable.Aux[[A] =>> Store[S, A], S] = | |
new Representable[[A] =>> Store[S, A]]: | |
override type Representation = S | |
override val F: Functor[[A] =>> Store[S, A]] = Functor[[A] =>> Store[S, A]] | |
override def tabulate[A](f: S => A): Store[S, A] = ??? | |
override def index[A](f: Store[S, A]): S => A = (s: S) => f.peek(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment