Comments (2)
This is interesting! I'm pretty busy this weekend, but next week I'll take a look at some core - I've always (optimistically) assumed that GHC has some generics-specific specialising that takes place, but maybe that was naïve.
I'd also be keen to hear more about your use case - I've also assumed that the O(log n)
access times for a generic rep would always be fast enough, as I thought the compiler requires that n < 62
. If your application involves a lot of read/writes, though, I can imagine this might start to build up! Maybe there are some other things we can do to fuse operations?
Thanks for opening up this discussion!
from higgledy.
Yeah as far as I know unless you're directly producing something Rep like and then consuming it GHC should go a good job deforesting the intermediate structure, but if you expect to work with something of type HKD f a for more than that then the tree representation would have to exist in memory, which would probably be a bad thing. Particularly for memory usage, there's a hell of a lot of pointer overhead with such a nestled representation (we actually have quite a few data types at work which have dozens of fields, so if we were to use this that would affect us a lot).
We don't currently have a use case for Higgledy, I'm just really interested in the technique and could probably put it to good use in some other projects down the line.
I'll see if I can find some time on the weekend to have a play with it.
from higgledy.
Related Issues (15)
- Consider exposing even more things HOT 1
- DeriveAnyClass for barbie instances
- Pretty printing lacks any brackets HOT 1
- Haddock for Construct should probably mention Applicative HOT 1
- Allow 'build' with named fields HOT 4
- using HKD from class methods HOT 4
- Think about sum types HOT 6
- A version of HKD which doesn't wrap a field in `f` if its already wrapped in same f HOT 1
- Does not build with generic-lens 2.0.0.0 HOT 3
- COnfusing Emoji choice HOT 2
- Prefer Data.Semigroup.Last HOT 3
- Something prevents AllB instances from working HOT 7
- Consider exporting all the things via Internal module and/or export a bit more HOT 2
- empty constructor with alternative HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from higgledy.