Comments (9)
How deep is the nesting? Also how are you constructing them? Is this using Nat indices?
from shapeless.
Hi, The nesting is only 1 step deep, and I construct them as follows:
case class A(str: String)
case class B(a: A)
val strLens = lens[B] >> 'a >> 'str
What is Nat indices?
Cheers
from shapeless.
OK, thanks. Are you able to put together a simple source file which demonstrates the compile time blow up?
"Nat indices" refers to the earlier mechanism of specifying lenses by positional offsets of fields (ie. lens[Foo] >> _1 >> _2, etc.).
from shapeless.
Here: http://pastebin.com/cNnuk8sg
Cheers
from shapeless.
Thanks for that. I needed to add case class GeoKeyDirectory()
to get it to compile successfully. When it did it took 176 seconds for that file on it's own on my laptop ... is that comparable to what you're seeing with that file in isolation?
from shapeless.
Hi, sorry I'm a scala rookie I must had forgot that class. It took me more time but then the file was in a large project and my computer is a bit slow.
However it's still way to long, any idea what would speed it up?
from shapeless.
Yes, I completely agree.
I'm fairly sure that this is the same issue which is at play in #50, which is due to compile time overheads in the use of singleton-typed Strings
as field selectors. It's not clear to me at the moment if this is a Scala compiler issue or something which is fixable in shapeless.
A workaround is to use Nat
field indices, ie.,
import shapeless.nat._
val artistLens = metaDataTagsLens >> _0
val copyrightLens = metaDataTagsLens >> _1
val dateTimeLens = metaDataTagsLens >> _2
val computerLens = metaDataTagsLens >> _3
val imageDescLens = metaDataTagsLens >> _4
val makerLens = metaDataTagsLens >> _5
val modelLens = metaDataTagsLens >> _6
val softwareLens = metaDataTagsLens >> _7
But this is, of course, very fragile if you are likely to reorder the elements of your case classes.
from shapeless.
Okay, I'm trying out monacle now, if that doesn't work out I will switch back to shapeless with Nat field indices. Thank you for the quick response by the way!
Cheers
from shapeless.
Fixed in d4c3c71.
from shapeless.
Related Issues (20)
- implicit summoning of records.Keys for singleton subtype of HList fail sporadically HOT 3
- Witness path-dependent type `T` lose refinement HOT 3
- Witness singleton type automatically erased by compile-time type inference HOT 3
- migrate to GitHub Actions HOT 1
- Implicit is not returned from the cache but rather from current scope HOT 3
- Tagged types based on anything other than AnyVals produces exception in Spark HOT 12
- Migrate to GitHub actions HOT 1
- `Default.AsRecord` causes `StackOverflow` in a path-dependent type's companion object HOT 5
- `ops.coproduct.Reify` broken HOT 1
- performance issue with combined `Length` and `ToSizedHList` implicit derivation HOT 3
- Generic in shapeless 2.3.5+ not working for classes with context bounds if some implicit value is present HOT 2
- Generic.Aux compiles but errors with ClassCastException at runtime HOT 3
- Shapeless 2.3.5+ can't provide implicit for Generic.Aux HOT 5
- _0 as defined is somehow causing extreme compile times HOT 1
- Possible derivation regression since shapeless 2.3.8 HOT 3
- Strange behavior when using -release 8 scalac option HOT 3
- Fix annotations with type parameter
- Shouldn't `KeyTag` be an abstract type rather than a trait? HOT 4
- `Generic` is not materialized in macro-generated companion object of nested case class HOT 1
- MkFieldLens.mkFieldLens returns a derived type instead of type parameter
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 shapeless.