Created
April 13, 2016 13:46
-
-
Save wpiekutowski/bc9e54d05786763a849fde5aa01ef6a6 to your computer and use it in GitHub Desktop.
kleisli gem: raise exception on None or unwrap value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'kleisli' | |
result = Maybe(something) | |
case result | |
when None() | |
raise 'operation failed' | |
else | |
puts result.value | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment