Skip to content
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

add a tutorial for polarity for haskellers #409

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MangoIV
Copy link
Collaborator

@MangoIV MangoIV commented Dec 6, 2024

I was writing this down yesterday while I thought a bit about how to compile polarity (the non-dependent fraction)

rendered

@MangoIV MangoIV changed the title [feat] add polarity for haskellers add a tutorial for polarity for haskellers Dec 6, 2024
@MangoIV MangoIV marked this pull request as ready for review December 6, 2024 14:07
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

see 25 files with indirect coverage changes

@MangoIV MangoIV force-pushed the mangoiv/polarity-for-haskellers branch from aea8b58 to 886c079 Compare December 6, 2024 14:15
@MangoIV MangoIV requested a review from BinderDavid December 6, 2024 14:21
@BinderDavid
Copy link
Collaborator

Super cool! I will go through and add some nitpicks. This also reminds me of https://inria.hal.science/hal-01653261/document by Laforgue and Regis-Gianas, who showed how to encode codata types in OCaml (instead of using Strict Haskell).

@timsueberkrueb
Copy link
Collaborator

Very cool, I'm wondering whether we could put this on the website instead, where it might be more accessible? Maybe we could have a section with guides/tutorials. Just an idea, happy to discuss :)

Copy link
Collaborator

@timsueberkrueb timsueberkrueb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some spelling mistakes.

contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
contrib/polarity-for-haskellers/README.md Outdated Show resolved Hide resolved
@timsueberkrueb
Copy link
Collaborator

timsueberkrueb commented Dec 16, 2024

Also in this context, we should perhaps note why we model infinite objects using codata and not via lazy data types with constructors. I think the issue is best explained by Berger and Setzer. They showed that pattern matching on streams defined by constructors is not a valid principle: there exists no decidable equality for streams which admits one step expansion s.t. any stream 𝑠 is equal to (cons n s) for some n, s. Originally these issues were found by Giménez and later rediscovered in Coq when subject reduction broke.

@timsueberkrueb
Copy link
Collaborator

timsueberkrueb commented Dec 16, 2024

One more note: The title is "Polarity for Haskellers" but at the moment it solely focuses on how to model infinite objects in Haskell vs Polarity. There are other differences worth mentioning, such as Polarity not having a built-in function type. So maybe we should change the title to "Codata for Haskellers" or expand on some of these other aspects?

Let's wait for @BinderDavid's thoughts on this.

@timsueberkrueb timsueberkrueb self-requested a review December 16, 2024 21:50
@MangoIV
Copy link
Collaborator Author

MangoIV commented Dec 16, 2024

One more note: The title is "Polarity for Haskellers" but at the moment it solely focuses on how to model infinite objects in Haskell vs Polarity. There are other differences worth mentioning, such as Polarity not having a built-in function type. So maybe we should change the title to "Codata for Haskellers" or expand on some of these other aspects?

No you are completely right. I should also write about this or at least make it more clear how haskell functions relate to the codata types of polarity.

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.

3 participants