Skip to content

exercise with Distance, foldMap and Maybe for Section 4.3#86

Closed
Liable5607 wants to merge 3 commits into
stefan-hoeck:mainfrom
Liable5607:exercise-for-section-4.3
Closed

exercise with Distance, foldMap and Maybe for Section 4.3#86
Liable5607 wants to merge 3 commits into
stefan-hoeck:mainfrom
Liable5607:exercise-for-section-4.3

Conversation

@Liable5607

Copy link
Copy Markdown
Contributor

When I was trying to get a handle on Monoids, I spent a lot of time playing with the Distance example. Personally I found that really helpful. One of those practice problems (calculating the Euclidean distance) also involved foldMap and Maybe so I thought it might make a nice exercise.

@Liable5607 Liable5607 changed the title exercise with Distance foldMap and Maybe for Section 4.3 exercise with Distance, foldMap and Maybe for Section 4.3 Jul 12, 2025
@stefan-hoeck

Copy link
Copy Markdown
Owner

While I like the example for its practical relevance, I don't think that the square of a Distance is still a Distance. At least in physics - where we are strict about this kind of thing - it is not. So, semantically, square and sqrt are not sound. In addition, sqrt is a partial function.

I therefore wonder, if we'd need not explain more about this in order to include it here.

@Liable5607

Copy link
Copy Markdown
Contributor Author

Thanks, you're right. I'll try to think of a more sound exercise with these Idris concepts.

@Liable5607 Liable5607 closed this by deleting the head repository Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants