Perhaps this is an acceptable solution for your use cases.

It isn't, I'm afraid.

By the way, I'm well aware of the problem with effects and value restriction and such (hence my qualification above, with purity). However, I don't care if it fails from time to time (and I think I remember some check about purity being done somewhere in the module system). For my use-case, I don't care if I need to have access to the original source-code -- I mean to see the concrete definition of the functor rather than its signature -- either (though it seems a limitation in general).

Am I weird to run into this issue all the time or is it common?


PS: now that there are both applicative functors and generative functors, could applicative functors be restricted to being pure, so that this sort of manipulation become possible in a generic way?