Skip to content

Instantly share code, notes, and snippets.

@mlms13
Created May 13, 2020 23:17
Show Gist options
  • Save mlms13/afba8102187df363d1c87893f04a4d53 to your computer and use it in GitHub Desktop.
Save mlms13/afba8102187df363d1c87893f04a4d53 to your computer and use it in GitHub Desktop.
Brainstorming a structure for storing recipes
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