Home

Awesome

Classy

Software License Stability Travis

nimble

Haskell-style typeclasses for Nim.

Allows to instantiate collections of functions for a given type or type constructor.

Install

$ nimble install classy

Usage

import classy, future

typeclass Functor, F[_]:
  # proc map[A, B](fa: F[A], g: A -> B): F[B]
  proc `$>`[A, B](fa: F[A], b: B): F[B] =
    fa.map((a: A) => g)

instance Functor, seq[_]
assert: (@[1, 2, 3] $> "a") == @["a", "a", "a"]

Documentation

Module documentation is located here.

Also refer to example for a quick tutorial.

Testing

$ nimble tests

Stability

Highly experimental. API and behaviour subject to change.

Credits

License

The Unlicense. Please see License File for more information.