nigredo-tori / classy Goto Github PK
View Code? Open in Web Editor NEWTypeclasses for Nim
License: The Unlicense
Typeclasses for Nim
License: The Unlicense
typeclass A, [F, G]:
proc foo(f: F)
instance A, [X, Y] => [Option[X], Option[Y]]
should give the following:
proc foo[X](f: Option[X])
This project is a milestone for applying functional programming patterns in nim, it deserves some love!
For example, this blocking issue has been upgraded:
nim-lang/Nim#4104
also {.noSideEffect.} and {.raises: [].} can be added where needed to enforce some fp goodness
In Haskell you can do
foo: Show a; a -> IO ()
foo = print . show
-- same as foo a = print (show a)
How would such be done with classy ? I am still new to nim.
The point is thaht Show is the typeclass and a is the type parameter.
As in Either[string, int]
, without aliases, etc. getType
family seems to give either type's internal structure or just symbol for the instantiation instead
e.g. instance Foo, Bar, invalid()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.