Created
May 13, 2020 23:17
-
-
Save mlms13/afba8102187df363d1c87893f04a4d53 to your computer and use it in GitHub Desktop.
Brainstorming a structure for storing recipes
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
module Measurement = { | |
type t = | |
| Tsp | |
| Tbsp | |
| Cup | |
| Ounce; | |
}; | |
module Ingredient = { | |
type t = {name: string}; | |
}; | |
module Amount = { | |
type t = { | |
quantity: float, | |
measurement: Measurement.t, | |
}; | |
}; | |
module IngredientAmount = { | |
type t = { | |
name: string, | |
amount: Amount.t, | |
ingredient: Ingredient.t, | |
}; | |
}; | |
module RecipeStep = { | |
[@unboxed] | |
type t = | |
| Step(string); | |
let make: string => t = str => Step(str); | |
}; | |
type t = { | |
name: string, | |
ingredients: list(IngredientAmount.t), | |
overview: string, | |
directions: list(RecipeStep.t), | |
}; | |
let curryChicken = { | |
name: "Green Curry Chicken", | |
ingredients: [], | |
overview: "TODO", | |
directions: [RecipeStep.make("")], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment