Skip to content

Instantly share code, notes, and snippets.

@mebubo
Last active November 25, 2018 11:43
Show Gist options
  • Select an option

  • Save mebubo/9b644f10aba0868ea151537ec21db44f to your computer and use it in GitHub Desktop.

Select an option

Save mebubo/9b644f10aba0868ea151537ec21db44f to your computer and use it in GitHub Desktop.

class Person, class PersonWithId(id: PersonId, person: Person)

type PersonWithId = (PersonId, Person)

case class Person[ID](id: ID, name: String)

@tpolecat: Yes, and one with no id could be Person[Unit].

@tpolecat: If you don't mind having that database cruft in your model. I generally like to externalize it.

@tpolecat: The way I like to do this is (a) database ids are not part of the model, and (b) every foreign key introduces a type parameter. This gives you a cruft-free model that can be made cruftful generically for code that does care about database stuff.

https://gitter.im/scala/scala?at=5a98326a888332ee3ae8f7eb

Pure Functional Database Programming with Fixpoint Types—Rob Norris

Scala Italy 2018 - Miles Sabin - Adding kind-polymorphism to the Scala programming language

Add a type parameter! One 'simple' design change, a panoply of outcomes

This programmer modeled his code after wooden nesting dolls. What happens next will amaze you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment