This file contains hidden or 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
// 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) |
This file contains hidden or 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
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 { |
This file contains hidden or 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
// 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 |
This file contains hidden or 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
package net.ccombs.scalaFromJava; | |
import scala.Some; | |
import scala.Option; | |
import scala.None; | |
/** | |
* OptionExample | |
*/ |