Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 21 15:29
    gabejohnson commented #332
  • Apr 21 14:23
    somebody1234 commented #332
  • Apr 21 14:23
    somebody1234 commented #332
  • Apr 21 14:04
    gabejohnson commented #332
  • Apr 21 12:36
    somebody1234 opened #332
  • Nov 16 2021 21:41
    Ne4to777 commented #331
  • Nov 16 2021 09:14
    davidchambers commented #331
  • Nov 16 2021 09:12
    davidchambers edited #331
  • Nov 15 2021 17:09
    Ne4to777 commented #331
  • Nov 15 2021 17:08
    Ne4to777 commented #331
  • Nov 15 2021 17:08
    Ne4to777 commented #331
  • Nov 15 2021 17:03
    Ne4to777 commented #331
  • Nov 15 2021 17:03
    Ne4to777 commented #331
  • Nov 15 2021 16:56
    Ne4to777 commented #331
  • Nov 15 2021 14:05
    davidchambers closed #330
  • Nov 15 2021 09:42
    davidchambers commented #331
  • Nov 14 2021 03:53
    bergus commented #329
  • Nov 13 2021 22:51
    puffnfresh commented #331
  • Nov 13 2021 19:01
    CrossEye commented #329
  • Nov 13 2021 18:56
    CrossEye commented #331
Gustavo Santana
@santanaG
But nothing recent that has succeeded
David Chambers
@davidchambers

https://www.travis-ci.com/github/fantasyland/daggy/requests:

Could not authorize build request for fantasyland/daggy.

Aha! It's working now. I had to select a plan. 🤪
David Chambers
@davidchambers
Could you squash your three commits, @santanaG?
Gustavo Santana
@santanaG
sure
Gustavo Santana
@santanaG
Do I pr again?
I feel I did something wrong..
Gustavo Santana
@santanaG
Got it. I had to force a push, but it fixed it at least.
David Chambers
@davidchambers
Nice one!
David Chambers
@davidchambers
Z.toString is used in the test suite as well. You should update those references too.
Gustavo Santana
@santanaG
done
Gustavo Santana
@santanaG
done, and then thought about something else…
David Chambers
@davidchambers
:thumbsup:
Gustavo Santana
@santanaG
How come show(List.Cons) should be left undefined? If that is not too hairy a subject of course.
David Chambers
@davidchambers
How do you think show(List.Cons) should evaluate?
Gustavo Santana
@santanaG
The same way that `List.Cons.toString’ does?
David Chambers
@davidchambers
How is that?
Here is the Haskell behaviour:
$ ghci
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Prelude> data List a = Nil | Cons a (List a) deriving Show
Prelude> show Nil
"Nil"
Prelude> show Cons

<interactive>:3:1: error:
    • No instance for (Show (a0 -> List a0 -> List a0))
        arising from a use of ‘show’
        (maybe you haven't applied a function to enough arguments?)
    • In the expression: show Cons
      In an equation for ‘it’: it = show Cons
Gustavo Santana
@santanaG
Well if it is being modeled after Haskell’s show I guess that it makes sense. I was looking at the parallels with toString and assumed that there should be behavior there. It makes more sense to me now why it should NOT do anything. With that being said, is there any instance where that would be useful? That could have been a better question to ask.
David Chambers
@davidchambers
I leave it up to you.
Gustavo Santana
@santanaG
Thought to be fair. It does not return undefined right now.
// show(List)
{"@@tags": ["Cons", "Nil"], "@@type": "List", "Cons": List.Cons, "Nil":
            List.Nil, "is": function $isType(val) {
                  return typeName === type (val);
                }, "prototype": {"@@show": function sum$toString() {
                return this.constructor[TYPE] + '.' +
                       this[TAG] + arrToString (this[VALUES]);
              }, "cata": function sum$cata(fs) {
                var tags = this.constructor[TAGS];
                var tag;
                for (var idx = 0; idx < tags.length; idx += 1) {
                  tag = tags[idx];
                  if (!fs[tag]) {
                    throw new TypeError (
                      "Constructors given to cata didn't include: " + tag
                    );
                  }
                }
                return fs[this[TAG]].apply (fs, this[VALUES]);
              }, "constructor": <Circular>, "foo": "foo", "toString": function sum$toString() {
                return this.constructor[TYPE] + '.' +
                       this[TAG] + arrToString (this[VALUES]);
              }}, "toString": function typeRepToString() {
                return this[TYPE];
              }}
That is List not List.Nil
Sorry!
Gustavo Santana
@santanaG
show(List.Nil) === 'List.Nil' already behaved as expected
Gustavo Santana
@santanaG
'sets show(typeRep) to work bringing in line with toString, adds show tests for Tuple, List, List.Cons, List.Nil'
David Chambers
@davidchambers

https://github.com/fantasyland/daggy/releases/tag/v1.5.0

:point_up: Here you go, @santanaG. :)

Gustavo Santana
@santanaG
Holy cow!
Thanks, its nice to see that!
Nils Riedemann
@nocksock
On the specs, how do I read this? u['fantasy-land/map'](f) What's u - (and the other prefix-letters like v, A, w, c etcpp)? What's the idea (and benefit) of this type of notation?
2 replies
David Chambers
@davidchambers
@nocksock, the method needs to be named 'fantasy-land/map' rather than 'map'. Using .map anywhere in the specification would be misleading. I agree that the prefixes add a lot of noise!
Aron Griffis
@agriffis
I've been using Ramda successfully for a few years, but I haven't wrapped my head around fantasy-land. I'm looking at the README now, and I'm wondering, are the methods mentioned real methods on the data, or is this just a conceptual description? For example, in Applicative I see v['fantasy-land/ap'](A['fantasy-land/of'](x => x)) ... are these real object properties?
Aron Griffis
@agriffis
Ramda operates on plain JS data, but then refers to fantasy-land in its documentation, so I'm guessing that these are conceptual rather than real, but I'm kinda lost. Not looking to waste someone's time with a big explanation, but hoping for a hint that gets me unstuck.
Scott Sauyet
@CrossEye

@agriffis: Yes, these are real properties. FantasyLand used to specify things like map, ap, and of, but at the request of Ramda and others, these were replaced by impossible-to-mistake names that for many implementations are just aliases to their simply-named counterparts. The main issue is that it's difficult to know if MyGeospatialObject.map has to do with Functors or cartography.

As to wrapping your head around it, I highly recommend this tutorial: http://www.tomharding.me/fantasy-land/

Aron Griffis
@agriffis
@CrossEye Thanks!
Brian Scott Luther
@bsluther:matrix.org
[m]
Is there a way to get vscode to line up function arguments, a prettier extension maybe? So that if you have something like const foldThings = reduce(doSomeFolding)(seed)(foldable), you can align the arguments to reduce "vertically".. I wish I knew how to get it to show up as I mean here, but hoping someone knows what i mean
Here are some screenshots to better illustrate...
Not a big deal but I find myself spending more time I wish I was tabbing over and adding a single space to line things up... or maybe I'm formatting things oddly and should change my ways?
David Chambers
@davidchambers
Your formatting makes sense to me, @bsluther:matrix.org.
bsluther
@bsluther:matrix.org
[m]
Cool, do you know of any prettier settings or some other way to automatically format code that way? I'm using vscode
David Chambers
@davidchambers
No, sorry. I format my JavaScript code by hand. I find Vim's block mode helpful for adjusting indentation.
Brian Scott Luther
@bsluther:matrix.org
[m]
👍️ Thanks
Johnny Hauser
@m59peacemaker
Is it coherent to add .contramap to an IO?
I'm sure I should word that differently.
I mean to express the idea of having the exact thing IO typically means, but it takes an input you can transform before it consumes it with io.run()
Johnny Hauser
@m59peacemaker
create_this_thing
  (1)
  (console.log)
    .contramap (add(4))
    .run() // logs '5'
Johnny Hauser
@m59peacemaker
hmm... but maybe run() is supposed to take the argument... That wouldn't be quite what I'm looking for, if so.
Ludwig Magnusson
@TheLudd

Hello. I am wondering how chain works with classes that have 2 types such as Either or Future.

If I have a Future instance with a certain "left" type. If I chain it, does the chaining function have to return a future with the same type as the "left" value?
Example:

const myFuture: Future<string, number> = getSomeFutureInstance()

function fetchSomething (x: number): Future<Error, Result> {
    // ... implementation
}

// Is this call legal?
// If yes, how can I know if the result is Future<string, Result> or Future<Error, Result>
// Both the first call or the chained call could have failed.
const result = myFuture.chain(fetchSomething)
David Chambers
@davidchambers
The “left” type needs to be the same in both cases, @TheLudd.