fmap-archive / typeclasses.js

Proof-of-concept implementation of typeclasses in Javascript.
BSD 2-Clause "Simplified" License
2 stars 0 forks source link

better mixins #1

Closed fmap closed 10 years ago

fmap commented 10 years ago

How can we define instances for new classes? Besides the obvious provision, this'd let us define multiple instances valid for one type (think ZipList, Sum, Product..)

fmap commented 10 years ago
js> function S() {};
js> var s = new S();
js> s.constructor.toString();
"function S() {}"
js> /^function ([^(]+)\(/.exec(s.constructor.toString())[1]
"S" 
fmap commented 10 years ago

lol, this doesn't actually require any changes to the implementation. Closing.