-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Minor refactorings to improve readability.
- Loading branch information
Showing
3 changed files
with
56 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* sbt Scalariform plugin | ||
* Copyright 2010 Olivier Michallat | ||
*/ | ||
package com.github.olim7t.sbtscalariform | ||
|
||
/** The sole purpose of this file is to rename Option's "orElse" method to "andThen". | ||
* This is so much clearer when chaining functions that return Some[String] to indicate an error. | ||
*/ | ||
object ChainedAction { | ||
implicit def optionToChainedAction(o: Option[String]) = new ChainedAction(o) | ||
} | ||
|
||
class ChainedAction(lastResult: Option[String]) { | ||
def andThen(nextAction: => Option[String]) = lastResult orElse nextAction | ||
} |
This file contains 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
This file contains 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