Skip to content

clock: Improve hint #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions exercises/clock/.meta/hints.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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
13 changes: 13 additions & 0 deletions exercises/clock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down