Guest User

Untitled

a guest
Sep 2nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.78 KB | None | 0 0
  1. [<Measure>] type L // litres
  2. [<Measure>] type KG // Kilograms
  3.  
  4. type Ingredient<[<Measure>] 'u> =
  5.    | BaseIngredient of  string *  float<'u> * float * decimal // name, Unit Of Measure, qty, kg/UOM, price/UOM
  6.  
  7.  
  8. type IceCreamBaseBatch<[<Measure>] 'u> =
  9.    | IceCreamBaseMix of Ingredient<'u> * Ingredient<'u> * Ingredient<'u> // Ice Cream Base Batch is made up of 3 ingredients
  10.  
  11. type BananaIceCreamBatch<[<Measure>] 'u>  =
  12.    | IceCreamBase of int * IceCreamBaseBatch<'u> // to use as 1x Ice Cream Base Batch
  13.    // | Ld of string * decimal * BananaIceCreamBatch List
  14.  
  15. let OneMilk =  BaseIngredient("Milk", 5.0<L>, 1.1, 2.00m)
  16. let OneCream = BaseIngredient("Cream", 0.5<L>, 1.2, 5.00m)
  17. let OneSugar = BaseIngredient("Sugar", 0.4<KG>, 1.0, 4.00m)
  18.  
  19. //let OneIceCreamBase = // ??
Add Comment
Please, Sign In to add comment