Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/milessabin/shapeless
Generic programming for Scala
https://github.com/milessabin/shapeless
fp functional-programming generic-programming scala typelevel
Last synced: 6 days ago
JSON representation
Generic programming for Scala
- Host: GitHub
- URL: https://github.com/milessabin/shapeless
- Owner: milessabin
- License: apache-2.0
- Created: 2011-12-18T13:36:38.000Z (about 13 years ago)
- Default Branch: main
- Last Pushed: 2024-05-18T09:37:06.000Z (8 months ago)
- Last Synced: 2024-05-27T17:48:14.181Z (8 months ago)
- Topics: fp, functional-programming, generic-programming, scala, typelevel
- Language: Scala
- Homepage:
- Size: 6.78 MB
- Stars: 3,366
- Watchers: 103
- Forks: 530
- Open Issues: 33
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-scala-native - Shapeless - Library for generic programming. (Functional Programming)
README
# shapeless: generic programming for Scala
**shapeless** is a type class and dependent type based generic programming library for Scala. It had its origins in
several talks by Miles Sabin ([@milessabin][milessabin]), given over the course of 2011, on implementing [scrap your
boilerplate][syb] and [higher rank polymorphism][higherrank] in Scala. Since then it has evolved from being a resolutely
experimental project into a library which, while still testing the limits of what's possible in Scala, is being used
widely in production systems wherever there are arities to be abstracted over and boilerplate to be scrapped.[![Discord](https://img.shields.io/discord/632277896739946517.svg?label=&logo=discord&logoColor=ffffff&color=404244&labelColor=6A7EC2)](https://discord.gg/bSQBZA3Ced)
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/milessabin/shapeless)
[![Maven Central](https://img.shields.io/maven-central/v/com.chuusai/shapeless_2.13.svg)](https://maven-badges.herokuapp.com/maven-central/com.chuusai/shapeless_2.13)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.8.svg)](https://www.scala-js.org)## Projects which use shapeless
There is a wide variety of projects which use shapeless in one way or another ... see the
[incomplete list of projects][built-with-shapeless] for ideas and inspiration. If you are using shapeless and your
project isn't listed yet, please add it.[built-with-shapeless]: https://github.com/milessabin/shapeless/wiki/Built-with-shapeless
## Finding out more about the project
The [feature overview for shapeless-2.0.0][features200] provides a very incomplete introduction to shapeless.
Additional information can be found in subsequent [release notes][relnotes220]. If you are upgrading from
shapeless-2.0.0 you will find the [migration guide][migration210] useful. We're not satisfied with the current state
of the documentation and would love help in improving it. You can find an excellent guide to Shapeless here:
[The Type Astronaut's Guide to Shapeless](https://github.com/underscoreio/shapeless-guide).shapeless is part of the [Typelevel][typelevel] family of projects. It is an Open Source project under the Apache
License v2, hosted on [github][source]. Binary artefacts are published to the
[Sonatype OSS Repository Hosting service][sonatype] and synced to Maven Central.Most discussion of shapeless and generic programming in Scala happens on the #shapless channel of the [Typelevel
Discord][discord]. There is also a [mailing list][group] and [Gitter][gitter], but these are largely dormant now that
most activity has moved to Discord. Questions about shapeless are often asked and answered under the [shapeless tag on
StackOverflow][so]. Some articles on the implementation techniques can be found on [Miles's blog][blog], and Olivera,
Moors and Odersky, [Type Classes as Object and Implicits][tcoi] is useful background material.[features200]: https://github.com/milessabin/shapeless/wiki/Feature-overview:-shapeless-2.0.0
[relnotes]: https://github.com/milessabin/shapeless/wiki/Release-notes:-shapeless-2.0.0
[relnotes220]: https://github.com/milessabin/shapeless/wiki/Release-notes:-shapeless-2.2.0
[migration]: https://github.com/milessabin/shapeless/wiki/Migration-guide:-shapeless-1.2.4-to-2.0.0
[migration210]: https://github.com/milessabin/shapeless/wiki/Migration-guide:-shapeless-2.0.0-to-2.1.0
[milessabin]: https://twitter.com/milessabin
[syb]: https://www.microsoft.com/en-us/research/publication/scrap-your-boilerplate-with-class/
[higherrank]: http://homes.sice.indiana.edu/ccshan/cs252/usage.pdf
[typelevel]: http://typelevel.org/
[scalaz]: https://github.com/scalaz/scalaz
[spire]: https://github.com/non/spire
[tcoi]: http://ropas.snu.ac.kr/~bruno/papers/TypeClasses.pdf
[source]: https://github.com/milessabin/shapeless
[sonatype]: https://oss.sonatype.org/index.html#nexus-search;quick~shapeless
[wiki]: https://github.com/milessabin/shapeless/wiki
[group]: https://groups.google.com/group/typelevel
[so]: http://stackoverflow.com/questions/tagged/shapeless
[gitter]: https://gitter.im/milessabin/shapeless
[discord]: https://discord.gg/bSQBZA3Ced
[irc]: http://webchat.freenode.net?channels=%23shapeless
[blog]: http://milessabin.com/blog## Participation
The shapeless project supports the [Typelevel Code of Conduct][codeofconduct] and wants all of its
channels (mailing list, Gitter, IRC, github, etc.) to be welcoming environments for everyone.Whilst shapeless is a somewhat "advanced" Scala library, it is a lot more approachable than many people think.
Contributors are usually available to field questions, give advice and discuss ideas on the #shapeless [Discord channel][discord],
and for people wanting to take their first steps at contributing we have a selection of open issues flagged up as
being [good candidates to take on][goodfirstissue]. No contribution is too small, and guidance is always available.[codeofconduct]: https://typelevel.org/code-of-conduct.html
[goodfirstissue]: https://github.com/milessabin/shapeless/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22## Using shapeless
Binary release artefacts are published to the [Sonatype OSS Repository Hosting service][sonatype] and synced to Maven
Central. Snapshots of the main branch are built using GitHub actions and automatically published to the Sonatype
OSS Snapshot repository.### Try shapeless with an Ammonite instant REPL
The quickest way to get to a REPL prompt with the latest version of shapeless on the class path is to run the
provided ["try shapeless"][try-shapeless] script, which has no dependencies other than an installed JDK. This script
downloads and installs [coursier][coursier] and uses it to fetch the [Ammonite][ammonite] REPL and the latest version
of shapeless. It then drops you immediately into a REPL session,```text
% curl -s https://raw.githubusercontent.com/milessabin/shapeless/main/scripts/try-shapeless.sh | bash
Loading...
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/replBridge.sc
Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
Compiling /home/miles/projects/shapeless/(console)
Welcome to the Ammonite Repl 1.6.8
(Scala 2.13.1 Java 1.8.0_212)
If you like Ammonite, please support our development at www.patreon.com/lihaoyi
@ 23 :: "foo" :: true :: HNil
res0: Int :: String :: Boolean :: HNil = 23 :: "foo" :: true :: HNil@ Bye!
%
```[try-shapeless]: https://github.com/milessabin/shapeless/blob/main/scripts/try-shapeless.sh
[coursier]: https://github.com/coursier/coursier
[ammonite]: https://github.com/com-lihaoyi/Ammonite### shapeless-2.3.3 with SBT
To include the Sonatype repositories in your SBT build you should add,
```scala
resolvers ++= Seq(
Resolver.sonatypeRepo("releases"),
Resolver.sonatypeRepo("snapshots")
)
```[ci]: https://travis-ci.org/milessabin/shapeless
Builds are available for Scala 2.11.x, 2.12.x and 2.13.x. The main line of development for
shapeless 2.3.3 is Scala 2.13.2.```scala
scalaVersion := "2.13.5"libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3"
)
```For using snapshots of Shapeless you should add,
```scala
scalaVersion := "2.13.5"libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.4.0-SNAPSHOT"
)
```### shapeless-2.3.3 with Maven
shapeless is also available for projects using the Maven build tool via the following dependency,
```xml
com.chuusai
shapeless_2.13
2.3.3```
### Older releases
Please use a current release if possible. If unavoidable, you can find [usage information for older
releases][olderusage] on the shapeless wiki.[olderusage]: https://github.com/milessabin/shapeless/wiki/Using-shapeless:-older-releases
## Building shapeless
shapeless is built with SBT 1.3.10 or later, and its main branch is built with Scala 2.13.2 by default but also
cross-builds for 2.11.12 and 2.12.12.[namehashing]: https://github.com/sbt/sbt/issues/1640
## Contributors
+ Alex Zorab [@aleczorab](https://twitter.com/aleczorab)
+ Alessandro Lacava [@lambdista](https://twitter.com/lambdista)
+ Alexander Konovalov [@alexknvl](https://twitter.com/alexknvl)
+ Alexandre Archambault [@alxarchambault](https://twitter.com/alxarchambault)
+ Alistair Johnson [@AlistairUSM](https://twitter.com/AlistairUSM)
+ Allison H.
+ Alois Cochard [@aloiscochard](https://twitter.com/aloiscochard)
+ Andreas Koestler [@AndreasKostler](https://twitter.com/AndreasKostler)
+ Andrew Brett [@Ephemerix](https://twitter.com/Ephemerix)
+ Aristotelis Dossas [@teldosas](https://twitter.com/teldosas)
+ Arya Irani [@aryairani](https://twitter.com/aryairani)
+ Ben Hutchison [@ben_hutchison](https://twitter.com/ben_hutchison)
+ Ben James [@bmjames](https://twitter.com/bmjames)
+ Brian McKenna [@puffnfresh](https://twitter.com/puffnfresh)
+ Brian Zeligson [@beezee](https://twitter.com/bzeg)
+ Bryn Keller [@brynkeller](https://twitter.com/brynkeller)
+ Carlos Quiroz [@carlosmquiroz](https://twitter.com/carlosmquiroz)
+ Chris Hodapp [@clhodapp](https://twitter.com/clhodapp)
+ Cody Allen [@fourierstrick](https://twitter.com/fourierstrick)
+ Dale Wijnand [@dwijnand](https://twitter.com/dwijnand)
+ Daniel Urban
+ Dario Rexin [@evonox](https://twitter.com/evonox)
+ Dave Gurnell [@davegurnell](https://twitter.com/davegurnell)
+ David Barri [@japgolly](https://twitter.com/japgolly)
+ Denis Mikhaylov [@notxcain](https://twitter.com/@notxcain)
+ Dmitry Kovalev
+ Eugene Burmako [@xeno_by](https://twitter.com/xeno_by)
+ Fabio Labella [@SystemFw](https://twitter.com/SystemFw)
+ Filipe Nepomuceno
+ Frank S. Thomas [@fst9000](https://twitter.com/fst9000)
+ George Leontiev [@folone](https://twitter.com/folone)
+ Georgi Krastev [@Joro_Kr](https://twitter.com/joro_kr)
+ Hamish Dickenson [@hamishdickson](https://twitter.com/hamishdickson)
+ Harrison Houghton
+ Howard Branch [@purestgreen](https://twitter.com/purestgreen)
+ Huw Giddens
+ Hywel Andrews
+ Ievgen Garkusha
+ Jacob Barber [@jacoby6000](https://twitter.com/jacoby6000)
+ Jason Zaugg [@retronym](https://twitter.com/retronym)
+ Jean-Baptiste Giraudeau [@jb9i](https://twitter.com/jb9i)
+ Jean-Remi Desjardins [@jrdesjardins](https://twitter.com/jrdesjardins)
+ Jeff Martin
+ Jeff Wilde
+ Jeremy R. Smith [@jeremyrsmith](https://twitter.com/jeremyrsmith)
+ Jisoo Park [@guersam](https://twitter.com/guersam)
+ Johannes Rudolph [@virtualvoid](https://twitter.com/virtualvoid)
+ Johnny Everson [@johnny_everson](https://twitter.com/johnny_everson)
+ Jolse Maginnis [email protected] [@doolse2](https://twitter.com/doolse2)
+ Joni Freeman [@jonifreeman](https://twitter.com/jonifreeman)
+ Joseph Price
+ Juan José Vázquez Delgado [@juanjovazquez](https://twitter.com/juanjovazquez)
+ Julien Tournay [@skaalf](https://twitter.com/skaalf)
+ Jules Gosnell
+ Kailuo Wang [@kailuowang](https://twitter.com/kailuowang)
+ Kazuki Moriyama [@kazchimo](https://twitter.com/Kazuki_Moriyama)
+ Kenji Yoshida <[email protected]> [@xuwei_k](https://twitter.com/xuwei_k)
+ Kevin Wright [@thecoda](https://twitter.com/thecoda)
+ Lars Hupel [@larsr_h](https://twitter.com/larsr_h)
+ Lukasz Golebiewski [@LukaszGobiewsk1](https://twitter.com/LukaszGobiewsk1)
+ Mario Pastorelli [@mapastr](https://twitter.com/mapastr)
+ Matthew Taylor
+ Mathias Doenitz [@sirthias](https://twitter.com/sirthias)
+ Michael Donaghy
+ Michael Pilquist [@mpilquist](https://twitter.com/mpilquist)
+ Michael Zuber [@mgzuber91](https://twitter.com/mgzuber91)
+ Mike Limansky [@mike_limansky](https://twitter.com/mike_limansky)
+ Miles Sabin [@milessabin](https://twitter.com/milessabin)
+ n4to4 [@n4to4](https://twitter.com/n4to4)
+ Neville Li [@sinisa_lyh](https://twitter.com/sinisa_lyh)
+ Nikolas Evangelopoulos
+ Oleg Aleshko [@OlegYch](https://twitter.com/OlegYch)
+ Olivier Blanvillain
+ Olli Helenius [@ollijh](https://twitter.com/ollijh)
+ Owein Reese [@OweinReese](https://twitter.com/OweinReese)
+ Paolo G. Giarrusso [@blaisorblade](https://twitter.com/blaisorblade)
+ Pascal Voitot [@mandubian](https://twitter.com/mandubian)
+ Pavel Chlupacek [@pacmanius](https://twitter.com/pacmanius)
+ Peter Neyens [@pneyens](https://twitter.com/pneyens)
+ Peter Schmitz [@peterschmitz\_](https://twitter.com/peterschmitz_)
+ Renato Cavalcanti [@renatocaval](https://twitter.com/renatocaval)
+ Rob Norris [@tpolecat](https://twitter.com/tpolecat)
+ Robert Hensing
+ Ronan Michaux [@ronan_michaux](https://twitter.com/ronan_michaux)
+ Ryadh Khsib
+ Ryo Hongo [@ryoppy516](https://twitter.com/ryoppy516)
+ Sam Halliday [@fommil](https://twitter.com/fommil)
+ Sarah Gerweck [@SGerweck](https://twitter.com/SGerweck)
+ Sébastien Doeraene [@sjrdoeraene](https://twitter.com/sjrdoeraene)
+ Simon Hafner [@reactormonk](https://twitter.com/reactormonk)
+ Stacy Curl [@stacycurl](https://twitter.com/stacycurl)
+ Stanislav Savulchik [@savulchik](https://twitter.com/savulchik)
+ Stephen Compall [@S11001001](https://twitter.com/S11001001)
+ Tin Pavlinic [@triggerNZ](https://twitter.com/triggerNZ)
+ Tom Switzer [@tixxit](https://twitter.com/tixxit)
+ Tomas Mikula [@tomas_mikula](https://twitter.com/tomas_mikula)
+ Travis Brown [@travisbrown](https://twitter.com/travisbrown)
+ Valentin Kasas [@ValentinKasas](https://twitter.com/ValentinKasas)
+ Valerian Barbot [@etaty](https://twitter.com/etaty)
+ Valy Diarrassouba
+ Vladimir Matveev [@netvlm](https://twitter.com/netvlm)
+ Vladimir Pavkin [@vlpavkin](https://twitter.com/vlpavkin)
+ William Harvey
+ Yang Bo (杨博) [@Atry](https://twitter.com/Atry)
+ Zainab Ali [@_zainabali_](https://twitter.com/_zainabali_)