Skip to content

An implementation of the famous exercise done at the type level in Scala.

License

Notifications You must be signed in to change notification settings

memoizr/typelevel-fizzbuzz

Repository files navigation

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.

About

An implementation of the famous exercise done at the type level in Scala.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages