Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

adds ord #10

Merged
merged 1 commit into from
Mar 2, 2016
Merged

adds ord #10

merged 1 commit into from
Mar 2, 2016

Conversation

stoeffel
Copy link
Member

This adds a Ord type and makes Min and Max work with it. I will clean this up next week.

@stoeffel
Copy link
Member Author

Reminder for myself:
To define a Ord one should have to define max/min not empty.
Max should use Ord.max and Min -> Ord.Min

@stoeffel
Copy link
Member Author

I added some examples and changed Ord to have min/max instead of empty (see examples).
The only thing that I don't like of the current solution is that you end up with:
wrapped { x: wrapped { x: -8 } }

const {Max, Min, Ord} = require('../fantasy-monoids');
const log = (x) => console.log(x);
const concat = (x, y) => x.concat(y);
const mconcat = (xs, empty) => xs.length ? xs.reduce(concat) : empty();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimonRichardson mconcat would be a great helper. What say?
Should something like this go to fantasy-helpers or stay with the monoids?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please

@gilligan
Copy link

Not related to this PR but it would be nice to not spread the use of nodeunit further which is just entirely dead.

@stoeffel
Copy link
Member Author

Not related to this PR but it would be nice to not spread the use of nodeunit further which is just entirely dead.

Agreed.

@@ -0,0 +1,42 @@
const {Max, Min, Ord} = require('../fantasy-monoids');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this example I would prefer some unit tests that convey information on usage and behaviour. Unlike unit tests the example also does not contain the output so you have to actually run it and play with it to even know what the result is for sure.

Note that the fantasy checks merely ensure that certain laws are adhered to. That is something quite different.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jop, Will add some unit tests and move to mocha. @SimonRichardson okay with you?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or maybe I will just add some unit tests and do the move to mocha later. Currently all of the fl repos use nodeunit. I think when we decide to move to mocha ore something else, we should cleanup all repos.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to do it now because otherwise you are just creating additional tech debt and make the eventual switch more painful because there is yet another project that needs to be taken care of ;-)

Just my 2cents as an "outsider" ;)

@stoeffel
Copy link
Member Author

I moved the examples to the tests and added mconcat/ concat

@stoeffel stoeffel mentioned this pull request Feb 21, 2016
@stoeffel
Copy link
Member Author

I think this is ready to 🚢 . I consider moving to mocha in a separate PR (I'm totally in favour of that, never was a fan of nodeunit.). @SimonRichardson anything to change, add? do you want me to squash the commits, or okay like this?

@SimonRichardson
Copy link
Member

I'd rather stick with nodeunit because the rest of the libraries are, so if we change we should change all of them. So 👎 for mocha atm

@stoeffel
Copy link
Member Author

Works for me.

@stoeffel stoeffel force-pushed the ord-experimental branch 2 times, most recently from 3e9e768 to 450585b Compare February 22, 2016 20:23
@stoeffel
Copy link
Member Author

rebased and ready to 🚢 IMO.

@SimonRichardson
Copy link
Member

OK I'll have a look tomorrow.

On Mon, 22 Feb 2016, 20:26 Christoph Hermann notifications@github.com
wrote:

rebased and ready to [image: 🚢] IMO.


Reply to this email directly or view it on GitHub
#10 (comment)
.

@stoeffel
Copy link
Member Author

Cool. let me know if I should change or add something.

@SimonRichardson
Copy link
Member

Sure, will do

On Mon, 22 Feb 2016, 20:28 Christoph Hermann notifications@github.com
wrote:

Cool. let me know if I should change or add something.


Reply to this email directly or view it on GitHub
#10 (comment)
.

@stoeffel
Copy link
Member Author

stoeffel commented Mar 2, 2016

did you have time to review this? anything to add? no need to hurry just want to check in.

@SimonRichardson
Copy link
Member

👍 Sorry for the delay, been really busy atm.

SimonRichardson added a commit that referenced this pull request Mar 2, 2016
@SimonRichardson SimonRichardson merged commit 98b6b50 into master Mar 2, 2016
@stoeffel
Copy link
Member Author

stoeffel commented Mar 2, 2016

Sorry for the delay, been really busy atm

no problem :-) Thanks for merging.

@stoeffel stoeffel deleted the ord-experimental branch March 2, 2016 09:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants