Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
David Chambers
@davidchambers
@Bradcomp, your point about migration is a good one. Even if we decide we don't want the method aliases it might be a good idea to keep them around for a while. They could even be undocumented during the transition.
Brad Compton (he/him)
@Bradcomp
Obviously one can always stay on whatever version they have that is working, but it's nice to be able to keep things up to date.
David Chambers
@davidchambers
I agree. It's no fun being stuck on an old version of a package.
Brad Compton (he/him)
@Bradcomp
Looking at #216 now. I like that Sanctuary is going to provide versions of all the FL functions. This would make the backwards compatibility less of an issue, but I still think keeping the deprecated functions for some period would be a good idea.
David Chambers
@davidchambers
Yep, I agree.
David Chambers
@davidchambers
I just removed the ramda dependency! v0.12.0 will depend on sanctuary-def and sanctuary-type-classes but not on ramda.
Irakli Safareli
@safareli
sweet
Brad Compton (he/him)
@Bradcomp
Awesome!

Is it possible using Sanctuary-def to create a TypeRef from a type? For instance

S.get($.FiniteNumber, 'a', {a: Infinity});

Obviously this code doesn't work as it stands because $.FiniteNumber is a type and not a TypeRef.

David Chambers
@davidchambers
Check out #191, @Bradcomp. It's currently blocked, but I'm bringing together the many loose ends so @Avaq will soon be able to update the pull request. We'll then be able to write:
S.get($.FiniteNumber._test, 'a', {a: Infinity});
Brad Compton (he/him)
@Bradcomp
Great! The future for Sanctuary is looking bright!
David Chambers
@davidchambers
It has momentum at the moment. I'm really looking forward to the next release. I'm working on it full-time at the moment, but these things always take longer than expected. I know I'm getting close, though, because I'm working on documentation, doctests, and code style. :)
Brad Compton (he/him)
@Bradcomp
In the meantime, I suppose a getWhere function that will mimic the future get function.
Stefano Vozza
@svozza
@davidchambers wow. nice work!
David Chambers
@davidchambers
For now you could use R.filter after the fact, @Bradcomp:
const R = require('ramda');
const S = require('sanctuary');
const $ = require('sanctuary-def');

//    f :: Any -> Maybe FiniteNumber
const f = S.compose(R.filter($.FiniteNumber._test), S.get(Number, 'a'));

f({a: 42});
// => Just(42)

f({a: Infinity});
// => Nothing()
Thanks, @svozza! Nice to hear from you. :)
Stefano Vozza
@svozza
yeah sorry i've been off the radar for a good while. i have been lurking on the recent PRs though
looking good!
David Chambers
@davidchambers
I didn't mean to make you feel guilty. I'm just pleased to see you around.
Stefano Vozza
@svozza
:D
do we still want to do that mergeStrMaps function? i'm guess it needs a serious rebase
David Chambers
@davidchambers
I think sanctuary-type-classes defines Object#concat. Let me check.
Yes, it does:
        //  Object#concat :: StrMap a ~> StrMap a
        'fantasy-land/concat': function(strMap) {
          var result = {};
          for (var k in this) if (has(k, this)) result[k] = this[k];
          for (k in strMap) if (has(k, strMap)) result[k] = strMap[k];
          return result;
        },
Brad Compton (he/him)
@Bradcomp
Thanks for the help @davidchambers!
David Chambers
@davidchambers
You're welcome. :)
Stefano Vozza
@svozza
ah yes, i like it
David Chambers
@davidchambers
Here you go, @svozza:
const Z = require('sanctuary-type-classes');

Z.concat({x: 1, y: 1}, {y: 2, z: 2});
// => {x: 1, y: 2, z: 2}
Stefano Vozza
@svozza
very nice
David Chambers
@davidchambers
What do you think of the approach to dispatching in sanctuary-type-classes, Stefano?
Stefano Vozza
@svozza
i really like it
the code looks very clean
getBoundMethod is clever
i like how it won't ever leak out to the user that you're using this
David Chambers
@davidchambers
I love being able to define the various fantasy-land/ methods separately. I'm finally living the OOP dream. :stuck_out_tongue_winking_eye:
Stefano Vozza
@svozza
hehe
we should rewrite everything in Smalltalk imo
David Chambers
@davidchambers
Haha, yes!
Does that mean I need to stop using Vim?
Stefano Vozza
@svozza
David Chambers
@davidchambers
:)
David Chambers
@davidchambers
If you're excited about the upcoming Sanctuary release and would like to help make it happen, a review of #259 would be much appreciated.
Brad Compton (he/him)
@Bradcomp
Looks great @davidchambers
David Chambers
@davidchambers
Thanks for your feedback. :)
David Chambers
@davidchambers
Small pull request seeks :eyes:: sanctuary-js/sanctuary-def#82.
It'll mean we can use $.__ or S.__ without having to rely on R.__ (or define our own placeholder value).
David Chambers
@davidchambers

Adding this line to my ~/.vimrc just blew me away:

let g:markdown_fenced_languages = ['haskell', 'javascript']

Now JavaScript code within code blocks in Markdown files has syntax highlighting. :)

Stefano Vozza
@svozza
Nice!
Aldwin Vlasblom
@Avaq

Is there a nice analogue to || when working with Maybe (like Fluture#or)? If I have two Maybe as, I want to use the first Just, or Nothing, so:

or( Just('a') , Nothing ) = Just('a')
or( Nothing , Just('b') ) = Just('b')
or( Just('a') , Just('b') ) = Just('a')
or( Nothing, Nothing ) = Nothing

Or am I looking over a better way to do this kind of thing?

Maybe#concat comes really close, but then it tries to concat its value.
Brad Compton (he/him)
@Bradcomp
@avaq Sanctuary has an or function that I think does just that.