-
-
Save iancanderson/5622b9c94847ff11ce1a47711180543c to your computer and use it in GitHub Desktop.
make it werrkkkk
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
data Hop = Hop {name :: String, alphaAcid :: Double} deriving (Show) | |
type BoilTime = Double | |
type Ounces = Double | |
data HopAddition = HopAddition Hop Ounces BoilTime deriving (Show) | |
data HomebrewRecipe = HomebrewRecipe [HopAddition] deriving (Show) | |
-- http://www.realbeer.com/hops/FAQ.html#units | |
recipeIbus :: HomebrewRecipe -> Double | |
recipeIbus (HomebrewRecipe as) = sum $ map ibus as | |
ibus :: HopAddition -> Double | |
ibus (HopAddition hop ounces boilTime) = (utilization boilTime) * ounces * (alphaAcid hop) * 7490 / 5 | |
utilization :: BoilTime -> Double | |
utilization t = bignessFactor * boilTimeFactor(t) | |
bignessFactor :: Double | |
bignessFactor = 1.65 * 0.000125 ** (wortGravity - 1) | |
e :: Double | |
e = exp 1 | |
boilTimeFactor :: BoilTime -> Double | |
boilTimeFactor t = (1 - e ** (-0.04 * t)) / 4.15 | |
wortGravity :: Double | |
wortGravity = 1.050 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment