Closed raehik closed 2 years ago
Looks like the compile time increase is much bigger than I thought, and memory usage too. The main module it should affect is Language.Fortran.AST
. Running stack ghci
on master and this branch and timing that module (mem% is from htop) shows:
Bit unsure now. I wonder if it would improve if Expression
weren't so mutually recursive.
The extra work generic-lens has to do for safe derivations is just too much. At least it's shown me another questionable instance to remove. I'm replacing this PR with one which doesn't alter the generic derivation over here: https://github.com/camfort/fortran-src/pull/219
Our generics code was unsafe in that if you tried to derive an instance which was invalid (e.g. you say an
a
is the first parameter in each constructor, but it isn't), it would still derive an instance, but give you anundefined
runtime error upon using it. Pushing that error to compile time is complex, but it's a solved problem by kcsongor's in his wonderful generic-lens library.This change adds generic-optics and optics-core to dependencies. They're very lightweight. Performance should be the same; compile time should most likely increase.