Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

everything #3

Merged
merged 1 commit into from
May 27, 2018
Merged

everything #3

merged 1 commit into from
May 27, 2018

Conversation

svozza
Copy link
Member

@svozza svozza commented Feb 23, 2017

The only purpose of this PR is for me to have a place to ask questions about the splitting out of Maybe from the main Sanctuary code base. Ignore the contents of index.js for the moment, I pretty much just ripped the Maybe code out from Sanctuary and deleted everything unrelated.

My initial question is about how to do the tests. Look at the tests for of. Should I use Sanctuary to invoke the method or should I use Maybe['fantasyland/of].of(1)? If the latter, is it OK to create an alias like this and reuse it throughout the test:

var mOf = M.Maybe['fantasy-land/of'];

Also, I get a strange output from the toString function, which is why it's commented out:

function Just(x){__cov_WlJQeVAavBNINCJxUZrEug.f['8']++;__cov_WlJQeVAavBNINCJxUZrEug.s['31']++;return new _Maybe('Just',x);}

Looks like something to do with the code coverage.

One last thing, does CircleCI have to be enabled on this repo?

test/of.js Outdated
@@ -0,0 +1,17 @@
'use strict';

var M = require('..');
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to be able to write var Maybe = require('sanctuary-maybe') without needing .Maybe at the end. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, how would we do that though? How would a use create a Just or a Nothing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Are you suggesting I add Just and Nothing to Maybe's prototype?

Copy link
Member

Choose a reason for hiding this comment

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

We could attach Just and Nothing to Maybe. The downside would be we'd then have both S.Nothing and S.Maybe.Nothing in Sanctuary. It may not be a good idea after all. Let's stick with M for now. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, makes sense, there'll be plenty more iterations to nail this down. :)

test/of.js Outdated
eq(mOf.length, 1);
// eq(mOf.toString(), 'of :: Applicative f => TypeRep f -> a -> f a');

eq(mOf(42), M.Just(42));
Copy link
Member

Choose a reason for hiding this comment

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

I think this is the only test we need for of:

eq(Z.of(Maybe, 42), Maybe.Just(42));

var assert = require('assert');

var equals = require('./equals');
var toString = require('./toString');
Copy link
Member

Choose a reason for hiding this comment

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

Why not require sanctuary-type-classes directly and use Z.toString?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I just copied and pasted this bit to get the of test working for the moment. ;)

@safareli
Copy link
Member

what about fantasyland/fantasy-maybes#8 ?

@svozza
Copy link
Member Author

svozza commented Feb 24, 2017

Yeah, we discussed it here:

sanctuary-js/sanctuary#335

@@ -0,0 +1,463 @@
(function(f) {
Copy link
Member

Choose a reason for hiding this comment

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

Let's add this:

//  ,______  ______,  ,________,,_____,,_____,,__________  ,__________,
//  |      \/      |  |        ||     ||     ||          \ |          |
//  |_,          ,_|  |_      _||_    ||    _||_,   __    ||_,   _____|
//    |   \  /   |     /      \   \   \/   /    |        /   |      |
//  ,_|    ||    |_,,_/   /\   \_, \      /   ,_|   __   \ ,_|   ___|_,
//  |      ||      ||     ||     |  |    |    |           ||          |
//  |______||______||_____||_____|  |____|    |__________/ |__________|

Copy link
Member Author

Choose a reason for hiding this comment

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

index.js Outdated
'sanctuary-def',
'sanctuary-type-classes',
'sanctuary-type-identifiers'
];
Copy link
Member

Choose a reason for hiding this comment

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

index.js Outdated

// readmeUrl :: String -> String
function readmeUrl(id) {
var version = '0.12.0'; // updated programmatically
Copy link
Member

Choose a reason for hiding this comment

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

Let's change this to '0.0.0'.

@svozza svozza force-pushed the svozza/everything branch from 7c9ca16 to 7a1748c Compare March 14, 2017 21:55
@svozza
Copy link
Member Author

svozza commented Mar 14, 2017

Addressed the comments and added the Just tests, am I going in the right direction (ignore index.js for now)?

@davidchambers
Copy link
Member

[A]m I going in the right direction[?]

I think so. It's a little hard for me to know what you changed. It's probably a good idea to treat your branch as append-only for the time being. :)

It might be helpful to consult sanctuary-js/sanctuary-either#3. The two pull requests should end up being very similar in many respects.

@svozza
Copy link
Member Author

svozza commented Mar 15, 2017

Yeah, I won't squash commits for now. The only thing I added was test/Just.js. I want to know if they're OK before I do test/Nothing.js and test/Maybe.js.

@davidchambers
Copy link
Member

The only thing I added was test/Just.js.

That file LGTM. :)

@davidchambers
Copy link
Member

Are you happy for me to push commits to your branch, Stefano?

@svozza
Copy link
Member Author

svozza commented Mar 16, 2017

Yeah, go for it.

@svozza
Copy link
Member Author

svozza commented Mar 18, 2017

Final tests are in now.

@svozza svozza force-pushed the svozza/everything branch from 8171b40 to 5f4b5f3 Compare March 18, 2017 18:02
@davidchambers davidchambers changed the title WIP - Split Maybe Out From Sanctuary everything Mar 19, 2017
@svozza
Copy link
Member Author

svozza commented Mar 20, 2017

Looking good!

@svozza
Copy link
Member Author

svozza commented Apr 13, 2017

What else do we need to do here?

@davidchambers
Copy link
Member

The next step, Stefano, is to merge sanctuary-js/sanctuary-identity#3. We can then release [email protected] and update this pull request to depend on it.

@edahlseng
Copy link

What's the status on this pull request?

@davidchambers
Copy link
Member

davidchambers commented Feb 4, 2018

What's the status on this pull request?

I've been waiting to find time to wrap up three pull requests on which this pull request depends:

I've found some time today. I hope to release sanctuary-maybe by the end of February. 🤞

@davidchambers
Copy link
Member

I'm about to squash the commits. The original commits can be found at 7c6471b.

Co-authored-by: Stefano Vozza <[email protected]>
@davidchambers davidchambers merged commit c0d626c into master May 27, 2018
@davidchambers davidchambers deleted the svozza/everything branch May 27, 2018 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants