Nutri-0.1: A little library to calculate nutrition values of food items.

Safe HaskellSafe-Inferred

Data.Nutrition.Food

Synopsis

Documentation

data Food Source

The Food data type consists of four things:

  • foodname A name of the food.
  • macros The macro nutrients of that specific food-item.
  • calories A calculated caloric value saved in kilo calories.
  • amount The amount of the actual food.

Constructors

Food 

Instances

Show Food

Food is an instance of the Show class, so it can be printed onto the screen.

Monoid Food

Food is an instance of the Monoid class. That leads to the possibility of combining foods to meals together.

(.@) :: Weight -> (Weight -> Food) -> FoodSource

A simple operator so one can write the Weight value prefix to the food.

kcal :: Food -> IntSource

kcal takes a food item and gives back the kilo-caloric value. This value is calculated from the macro-nutrition values.

foodGenerator :: String -> (Protein, Carb, Fat) -> Weight -> FoodSource

This function is a smart constructor to construct a food item. If no Weight is supplied, a food generating function for a specific food item is returned.

prot :: Food -> FloatSource

The prot, carb and fat functions return the value of the macro-nutrients in gram's.

fat :: Food -> FloatSource

The prot, carb and fat functions return the value of the macro-nutrients in gram's.

carb :: Food -> FloatSource

The prot, carb and fat functions return the value of the macro-nutrients in gram's.

addFood :: Food -> Food -> FoodSource

The addFood function does the combination of two foods into another one.