Skip to content

LasVegasFunctionalProgrammingGroup/scala-contextbounds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scala-contextbounds

Usage of context bounds in Scala. (That's the : B part in `foo[A : B] = /* body */)

The first example is the code in /src/main/scala, read Host.scala and Defaults.scala first, then example.scala!

This example shows off adding a Default trait, which is then used to provide a default value for any Option[T] that is a None. ex:

  val a: Option[Int] = None
  println(a.getOrDefault) // prints 0

The second example is in the sbt subproject uiexample, in the directory also named uiexample.

This example shows how context bounds can be used to add behavior without touching the structures they add logic for!

About

Usage of context bounds in Scala

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages