Skip to content

hexmind/typeclasses

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java typeclasses

Type classes example in Java. Inspired by Scala example (slides), Typeclasses

  • In Haskell, typeclass is the language feature.
  • In Scala, typeclass is a pattern.
  • In Java, typeclass is a experiment.

A type class is a type system construct that supports ad hoc polymorphism. This is achieved by adding constraints to type variables in parametrically polymorphic types. Such a constraint typically involves a type class T and a type variable a, and means that a can only be instantiated to a type whose members support the overloaded operations associated with T. Wikipedia

In this code Scala implicits are replaced by Spring DI. Case classes are created with Lombok @Value and matched by javaslang-match.

Requirements

Goals

Run

  • ./gradlew test

About

Type classes example in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published