Skip to content

Commit

Permalink
Add implicit function to unwrap results
Browse files Browse the repository at this point in the history
  • Loading branch information
NthPortal committed Sep 8, 2017
1 parent 6f89af8 commit 9ba39f8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions build.sbt
Expand Up @@ -3,8 +3,8 @@ name := "convert"
description := "A Scala library for handling conversions between types by throwing exceptions or returning Options " +
"containing the results."

val rawVersion = "0.2.0"
isSnapshot := false
val rawVersion = "0.3.0"
isSnapshot := true
version := rawVersion + { if (isSnapshot.value) "-SNAPSHOT" else "" }

scalaVersion := "2.12.3"
Expand Down
6 changes: 5 additions & 1 deletion src/main/scala/com/nthportal/convert/Convert.scala
Expand Up @@ -2,7 +2,7 @@ package com.nthportal.convert

import com.nthportal.convert.SpecializationTypes.specTypes

import scala.language.higherKinds
import scala.language.{higherKinds, implicitConversions}
import scala.reflect.ClassTag
import scala.util.control.{ControlThrowable, NonFatal}

Expand Down Expand Up @@ -143,6 +143,10 @@ sealed trait Convert {
case NonFatal(e: Exception) if matches(e) => fail(e)
}
}

object AutoUnwrap {
implicit def autoUnwrap[T](result: Result[T]): T = unwrap(result)
}
}

object Convert {
Expand Down

0 comments on commit 9ba39f8

Please sign in to comment.