Skip to content

allergies, space-age, meetup-day; Fully define data in stub #467

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 3 commits into from
Jan 9, 2017
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
1 change: 0 additions & 1 deletion exercises/allergies/.meta/DONT-TEST-STUB

This file was deleted.

10 changes: 9 additions & 1 deletion exercises/allergies/src/Allergies.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
module Allergies (Allergen(..), allergies, isAllergicTo) where

data Allergen = Dummy
data Allergen = Eggs
| Peanuts
| Shellfish
| Strawberries
| Tomatoes
| Chocolate
| Pollen
| Cats
deriving (Eq)

allergies :: Int -> [Allergen]
allergies = undefined
Expand Down
2 changes: 0 additions & 2 deletions exercises/meetup/.meta/DONT-TEST-STUB

This file was deleted.

8 changes: 3 additions & 5 deletions exercises/meetup/HINTS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
## Hints

To complete this exercise, you need to create the data types `Weekday`
and `Schedule`, and implement the function `meetupDay`.
To complete this exercise, you need to implement the `meetupDay` function.

You will find the type signature for `meetupDay` and dummy data declarations
already in place, but it is up to you to define the function and create
meaningful data types, newtypes or type synonyms.
You will find the type signature for `meetupDay` already in place,
but it is up to you to define the function.
16 changes: 14 additions & 2 deletions exercises/meetup/src/Meetup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@ module Meetup (Weekday(..), Schedule(..), meetupDay) where

import Data.Time.Calendar (Day)

data Schedule = Dummy
data Weekday = Dummy2
data Weekday = Monday
| Tuesday
| Wednesday
| Thursday
| Friday
| Saturday
| Sunday

data Schedule = First
| Second
| Third
| Fourth
| Last
| Teenth

meetupDay :: Schedule -> Weekday -> Integer -> Int -> Day
meetupDay schedule weekday year month = undefined
1 change: 0 additions & 1 deletion exercises/space-age/.meta/DONT-TEST-STUB

This file was deleted.

8 changes: 3 additions & 5 deletions exercises/space-age/HINTS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Hints

In this exercise, you need to complete the definition of the
In this exercise, we provided the definition of the
[algebric data data](http://learnyouahaskell.com/making-our-own-types-and-typeclasses)
named `Planet`, and implement the `ageOn` function, that calculates how many
named `Planet`.
You need to implement the `ageOn` function, that calculates how many
years old someone would be on a `Planet`, given an age in seconds.

Your can use the provided signature if you are unsure about the types, but
Expand All @@ -11,6 +12,3 @@ don't let it restrict your creativity:
```haskell
ageOn :: Planet -> Float -> Float
```

Keep in mind that the test suite will not compile until you correctly
implement the data type `Planet`.
9 changes: 8 additions & 1 deletion exercises/space-age/src/SpaceAge.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
module SpaceAge (Planet(..), ageOn) where

data Planet
data Planet = Mercury
| Venus
| Earth
| Mars
| Jupiter
| Saturn
| Uranus
| Neptune

ageOn :: Planet -> Float -> Float
ageOn planet seconds = undefined