Skip to content

Instantly share code, notes, and snippets.

@julianpeeters
Created May 3, 2023 03:51
Show Gist options
  • Save julianpeeters/9e02d0342db41d286f91e02f24617b7a to your computer and use it in GitHub Desktop.
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)
// 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