shapeless-2.3.0 is out!
Lots of issues closed (61 to be precise) and PRs merged (85 in total) from the largest number of contributors to any shapeless release so far (a grand total of 26 … thanks to all of you!). This release to some extent represents consolidation in the light of the experience of the many projects downstream of shapeless. But there have been other significant changes.
One of the biggest is that the project branch and build structure has been completely reworked. shapeless is now built for all permutations of Scala 2.10/11/12 and JVM and Scala.js from a single branch using macro-compat and the new support for JUnit in Scala.js 0.6.6+.
On the face of it, this runs counter to what I said in the release notes for 2.2.0,
My “one branch per platform” policy seems to be paying off: managing the differences between Scala 2.11.x and Scala 2.10.x for each of the JVM and Scala.js by branching and merging (as opposed to managing platform variations within a single branch) is working out very smoothly.
but I’m not backing away from that entirely.
It’s certainly true that managing releases from four branches became somewhat unweildy, but that was mitigated to a very large extent by the multi-branch relase script contributed by Johnny Everson. What really changed is that the state of the art for dealing with cross-platform builds for both Scala.JVM and Scala.JS has moved on significantly … I’d particularly like to thank Alistair Johnson for all the work he’s done on this across the entire gamut of Typelevel projects.
When I started work on export-hook I wanted to take advantage of that and, as an experiment, decided to try going for a single branch approach to dealing with macros on Scala 2.10.x vs. 2.11.x as well … this led to the development of macro-compat which I think has worked out beautifully. Having seen the benefits of this approach in export-hook it seemed that it would be worth seeing if it would scale to the more extensive macro usage in shapeless as well. To cut a long story short, it did … and I’d like to thank Dale Wijnand for his amazing contribution to that.
So where does that leave what I said in 2.2.0 release notes? In the absence of macro-compat, or something equivalent, if you have non-trivial macros, I still think it would be preferable to manage the difference between the 2.10.x and 2.11.x macro APIs by branching. But, for me at least, that’s now moot.
For the rest of the changes in 2.3.0, see the detailed release notes below …
Many thanks to everyone who contributed!
This is the final release of shapeless-2.3.0. These release notes provide a summary of changes since shapeless 2.2.5.
Prominent changes
85 pull requests have been merged and 61 issues have been closed and since 2.2.5 … the complete list can be found in the 2.3.0 github milestone for issues and PRs.
The project branch and build structure has been completely reworked. shapeless is now built for all permutations of Scala 2.10/11/12 and JVM and Scala.js from a single branch using macro-compat and the new support for JUnit in Scala.js 0.6.6+.
There are a large number of new features, refactorings and bug fixes in shapeless 2.3.0. The most significant of these are,
ADTs
- Many bug fixes and improvements in the implementation of
Generic. - Many bug fixes and improvements in the implementations of
Generic1,IsHCons1,IsCons1andSplit1in support of Kittens. - Added Annotation and Annotations type classes providing evidence of the presence of annotations on a type, or on the elements or constructors of an ADT.
- Added
Default,AsRecordandAsOptionstype classes providing evidence of the default values for the constructors of product types asHListsofOptionsor records. LabelledGeneric[T]no longer extendsGeneric[T].
HLists/Coproducts/tuples/records
- Dramatically improved compile time performance for record select and update.
- Added
zipWithIndexmethod andZipWithIndextype class forHLists,Coproductsand tuples. - Added
ToCoproduct/ToSumtype classes forHListsand tuples. - Added
toCoproductmethod andToCoproductTraversabletype class allowing conversion of anHListto a homogenous collection of theCoproductof its element types. - Added
selectMany,selectManyTypeandselectRangemethods andSelectManyandSelectRangetype classes allowing elements of anHListto be selected given a set or range ofNatindices. - Added
groupmethod andGrouperandPaddedGroupertype classes allowingHListsand tuples to be subdivided into smaller tuples of a given size. - Added
union,intersect,diffmethods andUnion,IntersectionandDifftype classes supporting set-like operations onHLists. - Added
updateAtWithmethod andModifierAttype class supporting functional update of elements ofHListsand tuples at a givenNatindex. - Added
collectFirstmethod andCollectFirsttype class which applies aPolyto the first compatible element of anHList. - Added
LiftAlltype class which collects instances of a type class for each element of anHList. - Added
padToandslicemethods andPadToandSlicetype classes which support padding and slicingHListsto/byNatindices. - Added
toRecordmethod andFromMaptype class which supports type safe conversion of a homogenousMapto a record. - Added
removeandremoveAllmethods andRemoveandRemoveAlltype classes supporting removing of one or more fields from a record. These operations are reversible viareinsertandreinsertAll. - Added
toSizedHListmethod andToSizedHListtype class which support conversion of a homogenous collection to anHListof a known size. - Added
impossiblemethod toCNil. - Improved readability of
toStringfor nestedHLists. - Improved
toStringforCoproducts.
Infrastructure
cachedImplicitnow uses a more reliable mechanism for preventing self-loops.- Added
StrictandCachedtype constructors which modify the semantics ofLazyby eliminating unnecessary closures and by sharing instances respectively. - Added
LowPrioritymechanism for controlling the priority of instances during implicit resolution. - User supplied
@implicitNotFoundannotations are now propagated throughLazy. - Added
NatProductArgswhich allows argument lists ofIntliterals to be mapped toHListsofNats. - Added
Range,GCD,LCM,GTandGTEqtype classes forNats. - Added
NatWithwhich supports conversion ofIntliterals toNatvalues and simultaneously summoning a specified type class at the correspondingNattype. - Added
Widentype class which allows the widening of a singleton type and value to the corresponding non-singleton type. - Added
runtimeListmethod allowing conversion of anHListto aList[Any]efficiently when precise types are not needed. - Added
unwrappedmethod andUnwrappedtype class which allow access to the value underlying a newtype or value class. - The experimental support for lifting polymorphic methods to
Polyvalues has been removed.
Source and binary compatibility
shapless 2.3.0 is source compatible with 2.2.5. As indicated by the version number bump, however, shapeless 2.3.0 is not binary compatible with shapeless 2.2.x.
Contributors
Contributors for shapeless 2.3.0 are,
- Alessandro Lacava @lambdista
- Alexandre Archambault @alxarchambault
- Andreas Koestler @AndreasKostler
- Chris Hodapp @clhodapp
- Cody Allen @fourierstrick
- Dale Wijnand @dwijnand
- Dave Gurnell @davegurnell
- Frank S. Thomas @fst9000
- Hamish Dickenson @hamishdickson
- Matthew Taylor
- Michael Donaghy
- Michael Pilquist @mpilquist
- Miles Sabin @milessabin
- Neville Li @sinisa_lyh
- Olivier Blanvillain
- Olli Helenius @ollijh
- Owein Reese @OweinReese
- Pavel Chlupacek @pacmanius
- Rob Norris @tpolecat
- Robert Hensing
- Ryo Hongo @ryoppy516
- Tin Pavlinic @triggerNZ
- Tomas Mikula @tomas_mikula
- Travis Brown @travisbrown
- Valentin Kasas @ValentinKasas
- Vladimir Pavkin @vlpavkin
Many thanks to all of you and everyone else who has contributed ideas, enthusiasm and encouragement.