Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Cond like constructor #3854

@LukeDefeo

Description

@LukeDefeo

Hello I was looking for a method like cond on Either. It would work like so:

object ZIO {
 def cond[E, A](predicate: Boolean, error: => E, result: => A): IO[E, A] = if (predicate) ZIO.succeed(result) else ZIO.fail(error)
}

is there another way of doing this? if not would you consider a pr with a method like this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions