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

Lift errors #4

Open
pitag-ha opened this issue Mar 15, 2023 · 13 comments
Open

Lift errors #4

pitag-ha opened this issue Mar 15, 2023 · 13 comments
Labels
good first issue Good for newcomers

Comments

@pitag-ha
Copy link
Owner

We currently have quite an ad-hoc implementation for cardio-crumble. In particular, it currently doesn't have a library-binary structure. One of the things we'll need to do for a hygienic structure is to avoid raising wherever we encounter errors. Instead, we should use the OCaml Result.t data structure in order to lift errors step by step up to the entry modules Simple_engine and Stat_engine.

One example of that is the termination of the process in Midi.Device.play. Instead, Midi.Device.play should return a Result.t value, which I suggest promoting via the Play module up to the Simple_engine and Stat_engine modules, where the Result.t value should be handled by exiting if there's an error.

As a first step for this, you could only lift the error from Midi.Device.play until the Play module and handle it in there already.

@pitag-ha pitag-ha added the good first issue Good for newcomers label Mar 15, 2023
@AryanGodara
Copy link
Contributor

@pitag-ha , Can I work on this after #3 is done?
This seems like a longer issue, to get to more familiar with Ocaml!

@pitag-ha
Copy link
Owner Author

Hi @AryanGodara, nice to see that you're keen on contributing to the MIDI project! I think it's better to stay focused on one task before taking on others. Do you prefer this issue or #3 to work on? I think they're similarly involved. #3 requires a little bit of knowledge about music as well.

In case you (or anyone else) is worried about issue shortage: I, and possibly @rand00 as well, will create more issues these days.

@pitag-ha
Copy link
Owner Author

Btw, if this issue seems hard to approach to anyone: I recommend reading the Real World OCaml chapter on error handling. And also: don't hesitate to ask if the issue is unclear!

@pitag-ha
Copy link
Owner Author

Oh, @AryanGodara, I've just seen that you've already opened a PR for #3 🎉 So, in that case: yes, feel free to start working on this if it's interesting for you. As mentioned, we'll also open other issues soon for people to have a bigger choice. Sorry for the confusion before!

@AryanGodara
Copy link
Contributor

No worries @pitag-ha , I'll start work on this first thing tomorrow morning!
This will be an interesting task, since I've to learn about error handling in ocaml anyways (I'm still going through docs are learning everything for each PR). Fun way to spend the weekend :)

@AryanGodara
Copy link
Contributor

@pitag-ha , I am working on this.
I have mid-sem exams this whole week, so progress will be slower, really sorry for that.
I'm reading real-world ocaml, and ocaml:correct+efficient right now,
and wanted to complete previous chapters before getting to error handling (my concepts aren't completely clear rightt now since I just started with ocaml recently)
I'll try to open a PR for this very soon though!!

@pitag-ha
Copy link
Owner Author

Ok, noted. No stress!

@pitag-ha
Copy link
Owner Author

@AryanGodara , I've just unassigned you from this issue in case someone else wants to work on it, given that you're working on #13 now. Does that sound good to you?

@AryanGodara
Copy link
Contributor

@AryanGodara , I've just unassigned you from this issue in case someone else wants to work on it, given that you're working on #13 now. Does that sound good to you?

Yes, thats perfect, I'll work on the CI issue for now!

@AryanGodara
Copy link
Contributor

@pitag-ha Can i come back and continue with this issue now, since i've completed the other tasks?

@pitag-ha
Copy link
Owner Author

pitag-ha commented Apr 3, 2023

Hi @AryanGodara, that's up to you! I've just written a longer message about that here.

@pitag-ha
Copy link
Owner Author

pitag-ha commented Apr 3, 2023

I've also just seen that you're working on an issue on fry, aren't you? Working only on one issue at a time vs working on two issues at once is now up to you as well. However, I still recommend focussing on one thing at a time.

@AryanGodara
Copy link
Contributor

I've also just seen that you're working on an issue on fry, aren't you? Working only on one issue at a time vs working on two issues at once is now up to you as well. However, I still recommend focussing on one thing at a time.

Yes, I'll complete the fry task first. And then switch over to this one. I just did not want to leave it as it was different from the other tasks (error handling) and I started it earlier 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants