fantasyland / static-land

Specification for common algebraic structures in JavaScript based on Fantasy Land
MIT License
770 stars 41 forks source link

Having a method doesn't mean having an algebra (problem with deriveAll) #5

Closed rpominov closed 8 years ago

rpominov commented 8 years ago

deriveAll does algebra detection based on what methods the type has. But, for example, if a type has of and chain it doesn't mean it has Monad algebra. To support an algebra a type must have certain methods, but this rule doesn't work in the reverse direction.

We probably should add an algebras argument to deriveAll. Automatic detection based on methods is a good default though.

rpominov commented 8 years ago

Maybe it's a good idea to require that type objects must have a property .algebras which is an array of supported algebra names.

We already have to pass around type objects, so it seems like a good idea to stash all useful meta information in them, so we at least have to pass only them.

rpominov commented 8 years ago

Closing because deriveAll is removed in https://github.com/rpominov/static-land/commit/0b6555c961311c187b228f1581b2eabe280ac167 . May revisit later.