[Haskell-cafe] [Haskell] ANN: syntactic-0.1
Emil Axelsson
emax at chalmers.se
Tue May 10 17:35:45 CEST 2011
2011-05-10 15:31, Heinrich Apfelmus skrev:
>>> I'm also unhappy about some of the boilerplate. For instance, have a
>>> look at the function goE in compileAccumB (line 210), it's just a
>>> generic applicative traversal through the data type.
>>
>> Most likely, this boilerplate could be simplified using syntactic.
>
> Hm, does the boilerplate get removed or only simplified? I was hoping
> that one could use a completely generic traversal; but is that actually
> the case?
I was using careful wording :) I think the traversal can be completely
generic. But syntactic brings its own (constant) overhead, so I felt the
word "remove" might be too strong.
> On closer inspection, I'm discovering another issue, namely the need for
> the Typeable class. This is quite unfortunate, because it would mean
> that I won't be able to make an API built on type classes like Functor
> or Applicative. Some discussion on that can be found at the end of
>
> http://apfelmus.nfshost.com/blog/2011/04/24-frp-push-driven-sharing.html
Hm... The only reason (afair) for having Typeable constraints in the
tree was that my code motion transform (not yet released) needs to move
around nodes in a way that the type checker is not happy with. But as
long as my algorithm is correct, the type casts will actually always
succeed. So it might be possible to use unsafeCoerce directly and get
rid of Typeable. There might also be ways to make Typeable optional...
I will look into this.
> So, it looks like I can't make use of syntactic at the moment. Then
> again, my library is probably one of the strongest tests of expressivity
> for endeavors like syntactic , so that's fine. Another example of
> similar difficulty would be D. Swierstra's recent parser/grammar
> combinators that can handle left-recursive grammars. Once syntactic
> can deal with those, you're the king! :)
Thanks for the tip! It would be interesting to try out these libraries
for real, if only for the sake of getting to know the practical limits
of syntactic. But my focus is currently on the Feldspar implementation,
so I probably won't have time for things like this in a (long) while.
/ Emil
More information about the Haskell-Cafe
mailing list