ValdemarGr / gql

A functional GraphQL implementation for Scala. https://valdemargr.github.io/gql/
Apache License 2.0
13 stars 3 forks source link

peephole optimizaiton #203

Open ValdemarGr opened 1 year ago

ValdemarGr commented 1 year ago

The step algebra should be able to be optimized by running a peephole algorithm.

Keep removing redundant expressions (Compose(Lift(f), Lift(g)) => Lift(f andThen g)) a'la chris okasaki's red-black tree rotations or someting similar. This can even have an impact on the semantics for choice, opening up new batching opportunities!

ValdemarGr commented 11 months ago

Unfortunately the program looks different (toString for debugging) after optimizing which can hurt debugging.

ValdemarGr commented 8 months ago

Lifting identity functions as an explicit step should prove useful