Skip to content

Instantly share code, notes, and snippets.

View rlmark's full-sized avatar

Rebecca rlmark

  • Unison Computing
  • Seattle, Washington
View GitHub Profile
@rlmark
rlmark / DtGib.markdown
Created October 14, 2014 04:53
A Pen by Rebecca.
@rlmark
rlmark / RNxOGw.markdown
Last active August 29, 2015 14:15
RNxOGw
// JSON AST
sealed trait JSON
case object JSNull extends JSON
case class JSString(get: String) extends JSON
case class JSNumber(get: Int) extends JSON
case class JSObject(get: Map[String, JSON]) extends JSON
final case class Person(name: String, email: String)
// Given any value, write it to JSON AST
@rlmark
rlmark / skeuomorph_update_dec19.md
Last active December 19, 2018 22:47
Updates/NeedAdvice

Updates / Seeking advice! Dec 18

Hi Muniverse, apologies for the delay, yesterday was our Seattle office party and I didn’t have as much time to try out the Traverse solution that Juan Pedro suggested. I’ve implemented a traverse function for ProtobufF and still run into the stack overflow error. (I also tried the @deriveTraverse annotation, which is way cool! But it also resulted in the stack overflow.) I’m analyzing the difference between the code that Juan Pedro suggested in my minimal repro app and the actual code and 1 big thing sticks out as a problem.

In the Skeuomorph code, TRepeated is constructed with a value of type A. This makes sense, TRepeated should contain some type which repeats, which could be another Message or just a primitive type, like a String.

Here’s a loose representation of the structure we have:

`BaseDescriptor`  ==========(Coalgebra)==========> `ProtobufF[A]` 
@rlmark
rlmark / skeuomorph_dec_28.md
Last active December 29, 2018 00:18
ProtobufOneOfsInvestigation

Protobuf One-Ofs

Currently my implementation of code-gen from protobuf One-Ofs allows you to print valid Scala code from a proto file containing One-of (eithers/coproducts), but you cannot create a valid proto file back. Let’s say you have the following proto file

message Person {
 string name = 1;

 oneof avatar {
 string image_url = 2;
@rlmark
rlmark / FPInScalaCh2.md
Last active July 16, 2019 23:50
Functional Programming in Scala Book Group Chapter 2

Chapter 2

Core Concepts

  • Higher order functions
  • Tail call optimization
  • Currying

Exercises

@rlmark
rlmark / FPInScalaCh3.1.scala
Created August 3, 2019 00:14
Functional Programming in Scala Chapter 3 Part 1
import scala.annotation.tailrec
sealed trait List[+A]
case object Nil extends List[Nothing]
case class Cons[+A](head: A, tail: List[A]) extends List[A]
object List {
def apply[A](as: A*): List[A] =
if (as.isEmpty) Nil
@rlmark
rlmark / FPInScalaCh4Pt2.md
Last active August 27, 2019 21:19
Functional Programming in Scala Chapter 4 part 2

Chapter 4 part 2: Eithers!

Review

  • Function composition
  • Higher order functions
  • Curry/Uncurry
  • Referential transparency
  • List (map, flatMap, filter, foldL, foldR)
  • Option (map, flatMap, filter)
@rlmark
rlmark / wordleCloneValidatorList
Last active March 31, 2022 21:22
wordleCloneValidatorList
aahed
aalii
aargh
aarti
abaca
abaci
aback
abacs
abaft
abaka