https://github.com/memoizr/typelevel-fizzbuzz
An implementation of the famous exercise done at the type level in Scala.
https://github.com/memoizr/typelevel-fizzbuzz
Last synced: 3 months ago
JSON representation
An implementation of the famous exercise done at the type level in Scala.
- Host: GitHub
- URL: https://github.com/memoizr/typelevel-fizzbuzz
- Owner: memoizr
- License: apache-2.0
- Created: 2016-10-02T15:03:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-28T15:25:39.000Z (over 8 years ago)
- Last Synced: 2025-02-12T07:55:31.611Z (5 months ago)
- Language: Scala
- Size: 54.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# typelevel-fizzbuzz
You have your series you know and love:
1, 2, Fizz, 4, Buzz, ...Now let's ask the compiler to build it for us in the form of the type of a shapeless `HList`, so we have:
_1 :: _2 :: Fizz :: _4 :: Buzz :: Fizz :: _7 ....
Credit to Miles (who else?) for implementing it as an example in shapeless. This is a variation that uses a typelevel range which is then mapped with a poly function to the desired series. Particular focus was put into making the typelevel code as expressive as possible. As with anything of this ilk, don't do this at home! This is just for entertainment purposes.
Enjoy.