Scala Shell
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4a66713 Jun 2, 2018

README.md

Hamsters

A mini Scala utility library. Compatible with functional programming beginners. For the JVM and Scala.js.

hamster logo

Currently, Hamsters supports :

  • Validation
  • Monad transformers
  • Future squash operations
  • Enum typeclass
  • Default values for options (orEmpty)
  • HLists
  • Union types
  • NonEmptyList
  • Show
  • mapN
  • Lenses
  • Memoization
  • Retry
  • Clazz

Documentation

2.6.0 documentation

Master documentation

Travis

Install as dependency

With SBT :

libraryDependencies ++= Seq(
  "io.github.scala-hamsters" %% "hamsters" % "2.6.0"
)

With Maven :

<dependency>
  <groupId>io.github.scala-hamsters</groupId>
  <artifactId>hamsters_${scala.version}</artifactId>
  <version>2.6.0</version>
</dependency>

For Scala.js :

libraryDependencies ++= Seq(
  "io.github.scala-hamsters" %%% "hamsters" % "2.6.0"
)

Try Hamsters in ScalaFiddle or Ammonite

You can try Hamsters quickly and easily with ScalaFiddle.
Example : https://scalafiddle.io/sf/BDm8W4U/0

Alternatively, a REPL script is provided. try-hamster.sh script downloads and installs Coursier, Ammonite REPL and Hamsters dependency. No dependencies needed other than a JDK.

PS: The macros don't work with the REPL

curl -s https://raw.githubusercontent.com/scala-hamsters/hamsters/master/scripts/try-hamsters.sh | bash

Loading...
Welcome to the Ammonite Repl 1.0.1
(Scala 2.12.3 Java 1.8.0_151)

@ val noneString: Option[String] = None 
noneString: Option[String] = None

@ noneString.orEmpty 
res1: String = ""

@ val hlist1: Double :: String :: HNil = 2.0 :: "hi" :: HNil 
hlist1: Double :: String :: HNil = HCons(2.0, HCons("hi", HNIL))

@ exit 
Bye!

1.x to 2.0 Migration

Validation.result has been renamed to Validation.run.

Extensions

See hamsters-extensions for more information.

Scaladoc

You can find the API documentation here.

Special thanks

To Laurencebeillaux who created the Hamsters logo.