Created
March 26, 2018 22:34
-
-
Save flash-gordon/632fd5ac7e55e48b1c702da6a349ab1d to your computer and use it in GitHub Desktop.
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
class Maybe | |
class Some < Maybe | |
end | |
class None | |
end | |
end | |
class Result | |
class Success < Result | |
def to_maybe | |
Maybe::Some.new(value!) | |
end | |
end | |
class Failure < Result | |
def to_maybe | |
None.new | |
end | |
end | |
end |
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
class Result | |
def to_maybe | |
raise "Load maybe!" | |
end | |
class Success < Result | |
end | |
class Failure < Result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment