Skip to content

Instantly share code, notes, and snippets.

View ClintCombs's full-sized avatar

Clint Combs ClintCombs

  • Jacksonville, FL
View GitHub Profile
// Ongoing thoughts about kinds in shapeless 3 and Scala 3.
// See the shapeless discussion here: https://discord.com/channels/632277896739946517/632312089616056350
trait BaseKind // AnyKind in Scala 3.x?
type Kind = Tuple | BaseKind
object K0 extends BaseKind {
override def toString: String = "*"
def *:(k: Kind): Tuple = (k, K0)
scala> case class Girl(name: String, age: Option[Int] = None)
defined class Girl
scala> Girl(name = "Sue")
res7: Girl = Girl(Sue,None)
scala> Girl(name = "Betty", age = Some(29))
res8: Girl = Girl(Betty,Some(29))
scala> res8.age match {
@ClintCombs
ClintCombs / Persons.scala
Last active August 29, 2015 14:02
Initialization for Groovy dudes.
// Scala Person case class
case class Person(first: String = "", last: String = "", age: Int = 0)
val p = Person(first = "John", last = "McPeek", age = 19)
val p1 = Person(first = "John")
// Scala PersonTrait
trait PersonTrait {
def first: String
def last: String
@ClintCombs
ClintCombs / OptionExample.java
Created June 28, 2012 19:02
Using Scala's Option from Java
package net.ccombs.scalaFromJava;
import scala.Some;
import scala.Option;
import scala.None;
/**
* OptionExample
*/