-
-
Save stephen-lazaro/f52816592ad4ab529715f63a150f71c4 to your computer and use it in GitHub Desktop.
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
// Aka an Applicative, though we won't talk about the connection here. | |
trait Monoidal[F[_]] { | |
// Named this way for Historical Reasons™ | |
def pure[A](x: A): F[A] | |
def map[A, B](fa: F[A])(f: A => B): F[B] | |
def product[A, B](fa: F[A], fb: F[B]): F[(A, B)] | |
} | |
object Monoidal { | |
// Some convenient boilerplate to "summon" our semigroupal | |
// again, ignore this if it doesn't make sense, allows Semigroupal[RowDecoder].map to work | |
def apply[F[_]](implicit semi: Monoidal[F]): Monoidal[F] = semi | |
} | |
// Specialized to RowDecoder! | |
implicit val monoidalForRowDecoder = new Monoidal[RowDecoder] { | |
def pure[A](x: A): RowDecoder[A] = ??? | |
def map[A, B](fa: RowDecoder[A])(f: A => B): RowDecoder[B] = ??? | |
def product[A, B](fa: RowDecoder[A], fb: RowDecoder[B]): RowDecoder[(A, B)] = ??? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment