diff --git a/exercises/clock/.meta/hints.md b/exercises/clock/.meta/hints.md index 203e3e034..2b7731849 100644 --- a/exercises/clock/.meta/hints.md +++ b/exercises/clock/.meta/hints.md @@ -1,5 +1,7 @@ ## Hints +It's a 24 hour clock going from "00:00" to "23:59". + To complete this exercise you need to define the data type `Clock`, add an `Eq` instance, and implement the functions: @@ -10,6 +12,17 @@ add an `Eq` instance, and implement the functions: `addDelta` adds a duration, expressed in hours and minutes, to a given time, represented by an instance of `Clock`. +`fromHourMin` takes an hour and minute, and returns an instance of `Clock` with +those hours and minutes. + +`toString` takes an instance of `Clock` and returns a string representation +of the clock, in 0-padded format like "08:03" or "22:35" + You will find a dummy data declaration and type signatures already in place, but it is up to you to define the functions and create a meaningful data type, newtype or type synonym. + +If you need help getting started with types, take a look at: +- [Data Types in 5 Steps][types] + +[types]: https://mmhaskell.com/blog/2017/12/24/haskell-data-types-in-5-steps diff --git a/exercises/clock/README.md b/exercises/clock/README.md index 98e992fdc..ba3812763 100644 --- a/exercises/clock/README.md +++ b/exercises/clock/README.md @@ -8,6 +8,8 @@ Two clocks that represent the same time should be equal to each other. ## Hints +It's a 24 hour clock going from "00:00" to "23:59". + To complete this exercise you need to define the data type `Clock`, add an `Eq` instance, and implement the functions: @@ -18,10 +20,21 @@ add an `Eq` instance, and implement the functions: `addDelta` adds a duration, expressed in hours and minutes, to a given time, represented by an instance of `Clock`. +`fromHourMin` takes an hour and minute, and returns an instance of `Clock` with +those hours and minutes. + +`toString` takes an instance of `Clock` and returns a string representation +of the clock, in 0-padded format like "08:03" or "22:35" + You will find a dummy data declaration and type signatures already in place, but it is up to you to define the functions and create a meaningful data type, newtype or type synonym. +If you need help getting started with types, take a look at: +- [Data Types in 5 Steps][types] + +[types]: https://mmhaskell.com/blog/2017/12/24/haskell-data-types-in-5-steps + ## Getting Started