Skip to content

Why doesn't dartz work with non-lambda functions? #110

@gerryau

Description

@gerryau

I have been going through a refactoring stage of a code base and looking through a list of snippets like:

  Either<ValueFailure<dynamic>, Unit> get failureOrUnit => value.fold(
        (l) => left(l),
        (r) => right(unit),
      );

If I attempt to change the first lamda function: (l) => left(l) to simply: left the code breaks. There are no errors, but the code doesn't work. Attempted code refactor:

  Either<ValueFailure<dynamic>, Unit> get failureOrUnit => value.fold(
        left,
        (r) => right(unit),
      );

Is someone able to explain this or tell me what I am missing here. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions