
Hi, Am Samstag, den 20.02.2016, 18:01 -0500 schrieb José Manuel Calderón Trilla:
The way I see it, the information would allow us to automatically unbox the arguments to constructors in sum types.
Well, unboxed sums asides, how can you unbox the argument to Just? "Just" necessary takes a boxed argument... Can you show some example code of a function that is strict in the way you envision, and show how the worker and the wrapper look like?
Combining this with the unboxed sums work, the idea is to be able to not only unbox the sum, but the fields of a constructor when possible, removing as many indirections as possible.
Yes, with unboxed sums there might be something to gain, i.e. replacing "Maybe Int" with "(# Int# | (##) #)" or whatever. But even then it is not clear: The function likely scrutinizes the argument, i.e. we have a branch, both before and after the transformation. But the wrapper _also_ needs to case-analyze the argument, to create the unboxed sum variant... and I worry that the wrapper will be optimized away very often. But a good example might convince me :-) Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org