Last active
August 29, 2015 14:16
-
-
Save gszeliga/18844ba168e42c4f11d2 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
object HipsterRules { | |
import com.covariantblabbering.builder.ApplicativeStyleWithExceptions._ | |
def facialHairStyle(hair: String) = { | |
if(hair.toLowerCase.contains("beard")) Continue(hair) | |
else Failure(new Exception("You need to make vikings envious with any bushy or scraggly beard")) | |
} | |
def tshirt(style: String) = { | |
if(style.toLowerCase.contains("v-neck")) Continue(style) | |
else Failure(new Exception("C'mon! We need to see some traces of your belly button")) | |
} | |
def acceptedBands(band: String) = { | |
val acceptedBands = List("fleet foxes", "sun kil moon", "neutral milk hotel") | |
acceptedBands find(_ == band.toLowerCase) map(Continue(_)) getOrElse Failure(new Exception(s"Do you still listen to '$band'? That name is not even poetic and/or ironic")) | |
} | |
def acceptedHobbies(hobbie: String) = { | |
val acceptedHobbies = List("knitting", "urban beekeepin", "taxidermy") | |
acceptedHobbies find(_ == hobbie.toLowerCase) map(Continue(_)) getOrElse Failure(new Exception(s"Nobody does '$hobbie' anymore today. Don't you got any friends around?")) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment