Skip to content

Instantly share code, notes, and snippets.

@MattMSumner
Created April 1, 2016 15:18
Show Gist options
  • Save MattMSumner/98960483453a4aa351d3d0e484cb3297 to your computer and use it in GitHub Desktop.
Save MattMSumner/98960483453a4aa351d3d0e484cb3297 to your computer and use it in GitHub Desktop.
data Hop = Hop {name :: String, alphaAcid :: Double} deriving (Show)
data BoilTime = BoilTime Int deriving (Show)
data HopAddition = HopAddition Hop BoilTime deriving (Show)
data HomebrewRecipe = HomebrewRecipe [HopAddition] deriving (Show)
recipeIbus :: HomebrewRecipe -> Double
recipeIbus (HomebrewRecipe as) = sum $ map ibus as
ibus :: HopAddition -> Double
ibus x = utilization x * ouncesOfHops * 7490 / 5
utilization :: HopAddition -> Double
utilization a = bignessFactor * boilTimeFactor
bignessFactor :: Double
bignessFactor = 1.65 * 0.000125 ** (wortGravity - 1)
boilTimeFactor :: Double
boilTimeFactor = undefined
wortGravity :: Double
wortGravity = 1.050
ouncesOfHops :: Double
ouncesOfHops = undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment