/hamsters

A mini Scala utility library

Primary LanguageScalaApache License 2.0Apache-2.0

Hamsters

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

hamster logo

Currently, Hamsters supports :

Travis

Install as dependency

With SBT :

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

With Maven :

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

For Scala.js :

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

Try Hamsters in ScalaFiddle or Ammonite

You can try quickly and easily Hamsters 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.