Re: [Haskell-cafe] What features should an (fictitious) IDE for Haskell have?

On 20-12-07 18:22, André Popovitch wrote:
One feature I've always wanted would be able to "manually inline" a function. For example, if I have
foo a = a + a bar = foo 3
I'd like to be able to right-click on the invocation of `foo` and select some option to inline it, rewriting the file to read
foo a = a + a bar = 3 + 3
I think this would make it simple to dive into an abstraction to see what's really going on. For example, imagine a new user is confused by this expression:
Just 3 >> Just 4
They could right-click on `>>` to see that it is identical to:
case Just 3 of Just _ -> Just 4 Nothing -> Nothing
Which would allow them to easily see that this expression will always evaluate to "Just 4" (and hopefully simplify it). Enlightened, they could then hit ctrl-z to revert the code to its original state.
Haskell's purity and laziness makes it one of the only mainstream languages where equational reasoning is really possible, so this feature would play on Haskell's strengths and provide a feature that couldn't be replicated in other languages' IDEs. It would also allow new users to more easily dive in and understand certain abstractions (although how it would work in many cases would be hard to determine).
+1 for this. It is like a step-by-step evaluation/debugger but limited to function calls at the syntactic level. I can image so many past situations where this would have prevented lots of head-scratching. This hypothetical IDE feature might go well with a tree view where inlining a function application is equivalent to expanding a level in a tree (within the same source line number), like so: Folded: [+] button appears on mouse over "foo". bar = foo[+] 3 Expanded: One code line now occupies two lines in the IDE window. [-] button reverts code to previous state. bar = foo 3 [-] 3 + 3 I've seen similar things in action in a demo implementation of [1,2]. Also great for teaching, I guess. Olaf [1] https://www.cs.bham.ac.uk/~pbl/papers/functionalexplainsupp.pdf [2] https://dl.acm.org/doi/10.1145/3110258
participants (1)
-
Olaf Klinke