Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/Function1/UnliftOps

UnliftOps

scala.Function1.UnliftOps
final implicitclassUnliftOps[A,B] extendsAnyVal

Attributes

Source
Function1.scala
Graph
Supertypes
classAnyVal
traitMatchable
classAny

Members list

Value members

Concrete methods

Converts an optional function to a partial function.

Converts an optional function to a partial function.

Attributes

Example

UnlikeFunction.unlift, thisUnliftOps.unlift method can be used in extractors.

val of: Int => Option[String] = { i =>  if (i == 2) {    Some("matched by an optional function")  } else {    None  }}util.Random.nextInt(4) match {  case of.unlift(m) => // Convert an optional function to a pattern    println(m)  case _ =>    println("Not matched")}
Source
Function1.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp