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
,IsCons1
andSplit1
in 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
,AsRecord
andAsOptions
type classes providing evidence of the default values for the constructors of product types asHLists
ofOptions
or records. LabelledGeneric[T]
no longer extendsGeneric[T]
.
HLists/Coproducts/tuples/records
- Dramatically improved compile time performance for record select and update.
- Added
zipWithIndex
method andZipWithIndex
type class forHLists
,Coproducts
and tuples. - Added
ToCoproduct
/ToSum
type classes forHLists
and tuples. - Added
toCoproduct
method andToCoproductTraversable
type class allowing conversion of anHList
to a homogenous collection of theCoproduct
of its element types. - Added
selectMany
,selectManyType
andselectRange
methods andSelectMany
andSelectRange
type classes allowing elements of anHList
to be selected given a set or range ofNat
indices. - Added
group
method andGrouper
andPaddedGrouper
type classes allowingHLists
and tuples to be subdivided into smaller tuples of a given size. - Added
union
,intersect
,diff
methods andUnion
,Intersection
andDiff
type classes supporting set-like operations onHLists
. - Added
updateAtWith
method andModifierAt
type class supporting functional update of elements ofHLists
and tuples at a givenNat
index. - Added
collectFirst
method andCollectFirst
type class which applies aPoly
to the first compatible element of anHList
. - Added
LiftAll
type class which collects instances of a type class for each element of anHList
. - Added
padTo
andslice
methods andPadTo
andSlice
type classes which support padding and slicingHLists
to/byNat
indices. - Added
toRecord
method andFromMap
type class which supports type safe conversion of a homogenousMap
to a record. - Added
remove
andremoveAll
methods andRemove
andRemoveAll
type classes supporting removing of one or more fields from a record. These operations are reversible viareinsert
andreinsertAll
. - Added
toSizedHList
method andToSizedHList
type class which support conversion of a homogenous collection to anHList
of a known size. - Added
impossible
method toCNil
. - Improved readability of
toString
for nestedHLists
. - Improved
toString
forCoproducts
.
Infrastructure
cachedImplicit
now uses a more reliable mechanism for preventing self-loops.- Added
Strict
andCached
type constructors which modify the semantics ofLazy
by eliminating unnecessary closures and by sharing instances respectively. - Added
LowPriority
mechanism for controlling the priority of instances during implicit resolution. - User supplied
@implicitNotFound
annotations are now propagated throughLazy
. - Added
NatProductArgs
which allows argument lists ofInt
literals to be mapped toHLists
ofNats
. - Added
Range
,GCD
,LCM
,GT
andGTEq
type classes forNats
. - Added
NatWith
which supports conversion ofInt
literals toNat
values and simultaneously summoning a specified type class at the correspondingNat
type. - Added
Widen
type class which allows the widening of a singleton type and value to the corresponding non-singleton type. - Added
runtimeList
method allowing conversion of anHList
to aList[Any]
efficiently when precise types are not needed. - Added
unwrapped
method andUnwrapped
type class which allow access to the value underlying a newtype or value class. - The experimental support for lifting polymorphic methods to
Poly
values 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.