[from now] 2014/04/10 23:23:30

[36mdiff --git a/src/Main.hs b/src/Main.hs[m
[36mindex 039010a..2bc701c 100644[m
[36m--- a/src/Main.hs[m
[36m+++ b/src/Main.hs[m
[34m@@ -1,7 +1,7 @@[m
[32m module Main where[m
[32m [m
[32m import Meal[m
[1m-import Workout[m
[4m+[m[4m--import Workout[m
[32m import Util.Util[m
[32m --import Data.Time[m
[32m --import Data.Time.Lens[m
[34m@@ -14,6 +14,7 @@[m[32m [m[33mmain = do[m
[32m     let lunch1 = defaultNutrient {calorie = Just 319, protein = Just 4.9, fat = Just 7.9, carbon = Just 57.4}[m
[32m     let lunch2 = defaultNutrient {calorie = Just (107 * 2), protein = Just (14.4 * 2), fat = Just (4.8 * 2), carbon = Just (1.48 * 2)}[m
[32m     let dinner = defaultNutrient {calorie = Just 363, protein = Just 16.3, fat = Just 5.8, carbon = Just 59.1}[m
[1m-    let total = show $ foldl1 nAdd [breakFirst, lunch1, lunch2, dinner][m
[1m-    writeFile "c:/HOME/learning_haskell/calorie/daily_data/20140410.txt" total[m
[4m+[m[4m    let dinner2 = defaultNutrient {calorie = Just 262, protein = Just 4.3, fat = Just 16.2, carbon = Just 24.7}[m
[4m+[m[4m    let total = show $ foldl1 nAdd [breakFirst, lunch1, lunch2, dinner, dinner2][m
[4m+[m[4m    writeFile "/Users/theatrical/learning_haskell/calorie_hs/daily_data/20140409.txt" total[m
[32m     putStrLn . show $ (applyBothSide (+) $ (*24) . length ) "1234567" "89"[m
[from now] 2014/04/11 00:48:33

[36mdiff --git a/src/Main.hs b/src/Main.hs[m
[36mindex 2bc701c..eea9b54 100644[m
[36m--- a/src/Main.hs[m
[36m+++ b/src/Main.hs[m
[34m@@ -15,6 +15,8 @@[m[32m [m[33mmain = do[m
[32m     let lunch2 = defaultNutrient {calorie = Just (107 * 2), protein = Just (14.4 * 2), fat = Just (4.8 * 2), carbon = Just (1.48 * 2)}[m
[32m     let dinner = defaultNutrient {calorie = Just 363, protein = Just 16.3, fat = Just 5.8, carbon = Just 59.1}[m
[32m     let dinner2 = defaultNutrient {calorie = Just 262, protein = Just 4.3, fat = Just 16.2, carbon = Just 24.7}[m
[1m-    let total = show $ foldl1 nAdd [breakFirst, lunch1, lunch2, dinner, dinner2][m
[1m-    writeFile "/Users/theatrical/learning_haskell/calorie_hs/daily_data/20140409.txt" total[m
[4m+[m[4m    let ice = defaultNutrient {calorie = Just 78, protein = Just 0.7, fat = Just 4.8, carbon = Just 8.1}[m
[4m+[m[4m    let dinner3 = ice `nMal` 2[m
[4m+[m[4m    let total = show $ foldl1 nAdd [breakFirst, lunch1, lunch2, dinner, dinner2, dinner3][m
[4m+[m[4m    writeFile "/Users/theatrical/learning_haskell/calorie_hs/daily_data/20140410.txt" total[m
[32m     putStrLn . show $ (applyBothSide (+) $ (*24) . length ) "1234567" "89"[m
[36mdiff --git a/src/Meal.hs b/src/Meal.hs[m
[36mindex 1bd0864..86b8625 100644[m
[36m--- a/src/Meal.hs[m
[36m+++ b/src/Meal.hs[m
[34m@@ -7,6 +7,7 @@[m[32m [m[33mmodule Meal ([m
[32m             , defaultMeal[m
[32m             , calorieCal[m
[32m             , nAdd[m
[4m+[m[4m            , nMal[m
[32m             , cMinus[m
[32m             ) where[m
[32m [m
[34m@@ -32,6 +33,16 @@[m[32m [m[33ma `nAdd` b = Nutrient{calorie  = cal, protein = p, fat = f, carbon = c}[m
[32m         f = fat a `nAdd'` fat b[m
[32m         c = carbon a `nAdd'` carbon b[m
[32m [m
[4m+[m[4mnMal :: Nutrient -> Float -> Nutrient[m
[4m+[m[4mn `nMal` a = Nutrient{calorie  = cal, protein = p, fat = f, carbon = c}[m
[4m+[m[4m    where[m
[4m+[m[4m        nMal' :: BaseUnit -> Float -> BaseUnit[m
[4m+[m[4m        n' `nMal'` a' = fmap (a' *) n'[m
[4m+[m[4m        cal = calorie n `nMal'` a[m
[4m+[m[4m        p = protein n `nMal'` a[m
[4m+[m[4m        f = fat n `nMal'` a[m
[4m+[m[4m        c = carbon n `nMal'` a[m
[4m+[m
[32m cMinus :: Nutrient -> Calorie -> Calorie[m
[32m cMinus nu c = calorie nu `nMinus'` c[m
[32m     where[m
[from now] 2014/04/11 00:48:50

[36mdiff --git a/daily_data/20140409.txt b/daily_data/20140409.txt[m
[36mindex 14b90d7..c450cfd 100644[m
[36m--- a/daily_data/20140409.txt[m
[36m+++ b/daily_data/20140409.txt[m
[34m@@ -1 +1 @@[m
[1m-Nutrient {calorie = Just 1383.0, protein = Just 59.6, fat = Just 43.4, carbon = Just 186.06}[m
[32m\ No newline at end of file[m
[4m+[m[4mNutrient {calorie = Just 1116.4, protein = Just 89.2, fat = Just 25.008, carbon = Just 130.075}workout : Just 910.0[m[7m[m
[32m\ No newline at end of file[m
[from now] 2014/04/11 00:49:51

[36mdiff --git a/daily_data/20140410.txt b/daily_data/20140410.txt[m
[36mnew file mode 100644[m
[36mindex 0000000..1cff210[m
[36m--- /dev/null[m
[36m+++ b/daily_data/20140410.txt[m
[34m@@ -0,0 +1 @@[m
[4m+[m[4mNutrient {calorie = Just 1539.0, protein = Just 61.0, fat = Just 53.0, carbon = Just 202.26}[m[7m[m
[32m\ No newline at end of file[m