Here's the same code but with a variation on Multiplate that doesn't use
records, but a GADT:
https://gist.github.com/1919528
It is easier on the eyes I think, but probably not any easier to decipher. But
hey, this is generic programming for mutually recursive datatypes, that's a
complicated
Thanks everyone! This has been interesting and helpful. I for one had
not seen multirec, but will check it out. Is the implication that
multirec is more or less complicated than multiplate?
Cheers,
-matt
On Sun, Feb 26, 2012 at 3:28 PM, Sjoerd Visscher sjo...@w3future.com wrote:
Here's the
On Feb 24, 2012, at 10:09 PM, Stephen Tetley wrote:
I'm not familiar with Multiplate either, but presumably you can
descend into the decl - collect the bound vars, then descend into the
body expr.
Naturally you would need a monadic traversal
rather than an applicative one...
It turns
That will give you the wrong answer for an expression like:
(let x = 1 in x + y) + x
Unless you do a renaming pass first, you will end up both with a bound
x and a free x.
On 25 February 2012 16:29, Sjoerd Visscher sjo...@w3future.com wrote:
On Feb 24, 2012, at 10:09 PM, Stephen Tetley
I don't understand what you mean.
($[]) . foldFor expr freeVariablesPlate $ Add (Let (x := Con 1) (Add
(EVar x) (EVar y))) (EVar x)
([y,x],[])
I.e. free variables y and x, no bound variables. Is that not correct?
Sjoerd
On Feb 25, 2012, at 7:15 PM, Thomas Schilling wrote:
That will give
No that's correct. I have to say the multiplate code is incredibly
hard to decipher.
On 25 February 2012 19:47, Sjoerd Visscher sjo...@w3future.com wrote:
I don't understand what you mean.
($[]) . foldFor expr freeVariablesPlate $ Add (Let (x := Con 1) (Add
(EVar x) (EVar y))) (EVar x)
On Thu, Feb 23, 2012 at 01:18:22PM -0800, Matt Brown wrote:
Hi all,
I'm reading the haskellwiki article on multiplate. Is it possible to
modify the getVariablesPlate example to return the free variables?
One idea I had is to store an environment in a reader monad, and use
local to update
I'm not familiar with Multiplate either, but presumably you can
descend into the decl - collect the bound vars, then descend into the
body expr.
Let $ decl child d * expr child e
This seems like a common traversal that Strafunski would handle, and
with Multiplate being a competitor / successor
Hi all,
I'm reading the haskellwiki article on multiplate. Is it possible to
modify the getVariablesPlate example to return the free variables?
One idea I had is to store an environment in a reader monad, and use
local to update the environment at a let expression. Couldn't figure
it out,