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

Extending wrappers & introducing functors, monads, comonads, and cowrappers #80

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from

Conversation

stefan-aws
Copy link
Contributor

@stefan-aws stefan-aws commented Feb 3, 2023

In the past, there have been requests to include monadic constructs into Dafny (see e.g. dafny-lang/dafny#455). The main issue with providing native support has been that monads don't fit as naturally into a partly imperative language as Dafny, as they do for purely functional languages. Here, I propose that instead of further embedding monads into the language itself, we simply provide a comprehensive standard library. The PR makes the following contributions:

  • Extends Wrapper.dfy with more wrappers and more functions for existing wrappers
  • Introduces a new file Cowrapper.dfy with currently one example, the Coreader cowrapper.
  • Axiomatises functors in Functors.dfy, monads in Monads.dfy, and comonads in Comonads.dfy
  • Shows that the examples in Wrapper.dfy are instances of monads, and the examples in Cowrapper.dfy are instances of comonads

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

@stefan-aws stefan-aws changed the title Proposal draft: Functors, monads, comonads and more wrappers Proposal draft: Functors, monads, comonads, wrappers, cowrappers Feb 3, 2023
@stefan-aws stefan-aws changed the title Proposal draft: Functors, monads, comonads, wrappers, cowrappers Extending wrappers & introducing functors, monads, comonads, and cowrappers Feb 3, 2023
This was linked to issues Feb 6, 2023
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.

Result monad Option monad
1 participant