Closed ccorcos closed 7 years ago
I think that breaks quite a few things, so will have to check. You can work around it by making the object aliases later.
const Maybe = extend(maybe, {Nothing, Some})
On Thu, 31 Mar 2016, 06:23 Chet Corcos, notifications@github.com wrote:
I want to get rid of these lines:
https://github.com/puffnfresh/daggy/blob/master/src/daggy.js#L113-L117
Otherwise you can't add a .map to Maybe.Nothing.prototype.
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/puffnfresh/daggy/issues/5
I have this same issue. @SimonRichardson is extend
defined somewhere?
Not that I'm aware of... Was just an idea, maybe it might be worth while adding, although you should add the prototype to the Maybe
type and not each sum, then use the catamorphism to identify it.
I believe, Nothing is just a value, and if you want to define some method on it you can just define it directly instead of doing it on it's prototype
Nothing.map = (f) => Nothing
Also you can get prototype of an object like this obj.constructor.prototype
Think this is closed now by @safareli comment. Re-open if you've got questions.
I want to get rid of these lines:
https://github.com/puffnfresh/daggy/blob/master/src/daggy.js#L113-L117
Otherwise you can't add a
.map
to Maybe.Nothing.prototype.