Skip to content

Instantly share code, notes, and snippets.

@RPallas92
Created September 24, 2017 11:40
Show Gist options
  • Save RPallas92/2e6fa475a82f4d5dac66b918ee56b565 to your computer and use it in GitHub Desktop.
Save RPallas92/2e6fa475a82f4d5dac66b918ee56b565 to your computer and use it in GitHub Desktop.
//The fmap function is only applied on Success values.
let success: Validation<String, Int> = Validation.Success(1)
success.fmap{ $0 + 1 }
// ==> Validation.Success(2)
let failure: Validation<String, Int> = Validation.Failure("error")
failure.fmap{$0 + 1}
// ==> Validation.Failure("error")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment