christopherdavenport / read   0.1.0

MIT License GitHub

Read Typeclass For Scala

Scala versions: 2.12 2.11

read Build Status Maven Central

Read Typeclass for Scala. Controversial? Yes. Problematic? Yes. Better than watching your friends write string.toInt and calling it good enough? Absolutely!

Quickstart

To use read in an existing SBT project with Scala 2.11 or a later version, add the following dependency to your build.sbt:

libraryDependencies += "io.chrisdavenport" %% "read" % "<version>"

Examples

import io.chrisdavenport.read.Read
import io.chrisdavenport.read.implicits._

"1".read[Int] // Right(1)

"Foo".read[Int] // Left

// For Those Who Want Haskell's Read
Read[Int].unsafeRead("1") // 1: Int