Zulip Chat Archive

Stream: general

Topic: Do desugaring


MangoIV (Aug 03 2023 at 15:41):

Hi, I’m currently reading Kha's thesis and especially the chapter about the desugaring of do and I’m surprised it’s completely different in the actual implementation. What are the reasons for that? If it’s performance is there smth else to consider but efficiency of Except transformers? Why is the reference impl in the thesis based on StateT and not on real mutable references with delimited scope ala Haskells ST?
Thanks in advance.

Mauricio Collares (Aug 03 2023 at 15:57):

https://publikationen.bibliothek.kit.edu/1000161074/151088087 for reference

Henrik Böving (Aug 03 2023 at 19:40):

@Sebastian Ullrich maybe?

Sebastian Ullrich (Aug 03 2023 at 20:16):

MangoIV said:

I’m surprised it’s completely different in the actual implementation. What are the reasons for that?

They were written more or less in parallel, by two different people, for different purposes. Even if in the end they can be compiled down to similar code, the optimization overhead for doing so is a greater concern for the full implementation.

ST I believe would harm verifiability and optimizability. Its complexity is simply not needed here.

MangoIV (Aug 03 2023 at 20:25):

harm optimisability
its complexity is simply not needed here

Oh really, that’s really unexpected for me, for one I’d expect in imperative code the match to be closer with mutable references due to how it’s simply one abstraction layer less and second I’d expect that it’s more complex to model multiple references with one context or have multiple contexts in StateT than in ST as in ST multiple references are “native”.

The point of the verifiability is not so surprising although I guess I would’ve expected the concept already being sufficiently formalised for it to not to be too hard to do.

On the first question: are there plans to eventually offer a second implementation s.t. this can be benchmarked against the current one? What do you expect the hurdles to be in terms of optimisation?

Thank you so much for your answer.

MangoIV (Aug 04 2023 at 15:37):

@Sebastian Ullrich I hope it’s okay that I ping you here again, just in case you overlooked it. Sorry if you didn’t. :3


Last updated: Dec 20 2023 at 11:08 UTC