Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nigredo-tori/classy
Typeclasses for Nim
https://github.com/nigredo-tori/classy
Last synced: 3 months ago
JSON representation
Typeclasses for Nim
- Host: GitHub
- URL: https://github.com/nigredo-tori/classy
- Owner: nigredo-tori
- License: unlicense
- Created: 2016-10-23T16:19:21.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-05-02T13:12:05.000Z (6 months ago)
- Last Synced: 2024-05-18T03:33:48.365Z (6 months ago)
- Language: Nim
- Size: 72.3 KB
- Stars: 28
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
- awesome-nim - classy - Haskell-style typeclasses for Nim. (Language Features / Object-Oriented Programming)
README
# Classy
[![Software License][ico-license]](license.md)
![Stability][ico-stability]
[![Travis][ico-travis]](https://travis-ci.com/nigredo-tori/classy)[![nimble](https://raw.githubusercontent.com/yglukhov/nimble-tag/master/nimble_js.png)](https://github.com/yglukhov/nimble-tag)
Haskell-style typeclasses for Nim.
Allows to instantiate collections of functions for a given type or type constructor.
## Install
```bash
$ nimble install classy
```## Usage
```nim
import classy, futuretypeclass 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"]
```
## DocumentationModule documentation is located [here](https://nigredo-tori.github.io/classy/head/classy.html).
Also refer to [example](example.nim) for a quick tutorial.
## Testing
```bash
$ nimble tests
```## Stability
Highly experimental. API and behaviour subject to change.
## Credits
- [nigredo-tori][link-author]
## License
The Unlicense. Please see [License File](license.md) for more information.
[ico-license]: https://img.shields.io/badge/license-Unlicense-brightgreen.svg?style=flat-square
[ico-stability]: https://img.shields.io/badge/stability-experimental-orange.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/nigredo-tori/classy/master.svg?style=flat-square[link-author]: https://github.com/nigredo-tori