Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 16 21:58
    davidchambers reopened #320
  • Mar 16 21:58
    davidchambers commented #320
  • Mar 16 20:52
    ivenmarquardt commented #320
  • Mar 16 20:52
    ivenmarquardt commented #320
  • Mar 16 20:29
    davidchambers commented #320
  • Mar 15 14:13
    ivenmarquardt closed #320
  • Mar 12 10:40
    ivenmarquardt edited #320
  • Mar 11 17:00
    ivenmarquardt edited #320
  • Mar 11 16:59
    ivenmarquardt opened #320
  • Jan 20 03:39
    davidchambers commented #319
  • Dec 22 2019 12:32
    MartinMuzatko edited #319
  • Dec 22 2019 12:31
    MartinMuzatko opened #319
  • Dec 15 2019 20:18
    rpominov commented #318
  • Dec 15 2019 20:08
    davidchambers commented #318
  • Dec 15 2019 19:41
    Ne4to777 closed #318
  • Dec 15 2019 19:41
    Ne4to777 commented #318
  • Dec 15 2019 19:30
    davidchambers commented #318
  • Dec 15 2019 18:59
    Ne4to777 opened #318
  • Nov 17 2019 14:44
    davidchambers commented #317
  • Nov 17 2019 00:42
    Avaq edited #317
Brian McKenna
@puffnfresh
leftMap is sometimes used for mapping over the "left" type parameter
sometimes called "first"
which is \f -> bimap f id
Ludwig Magnusson
@TheLudd
Looking around a bit more today I also found rejectedMap in data.task
I'm just wondering because I am building some stuff of my own and I wonder if I should name these functions anything special
Brian McKenna
@puffnfresh
it's a good question, bimap would be something we could use in the spec
Ludwig Magnusson
@TheLudd

Question about ap:
When the spec for functor says:

map must return a value of the same Functor

I take it that Maybe.map must return a Maybe

The spec for ap says:

b must be an Apply of any value

But can b be an Apply of any type? Or must it be the same type as ain a.ap(b)?

Brian McKenna
@puffnfresh
urgh, that wording looks pretty confusing...
clarification: it needs to be the same type constructor but can be different type
Maybe<Number> can become Maybe<String> for example
Ludwig Magnusson
@TheLudd

Maybe<Number> can become Maybe<String> for example

Yes, that is how I interpret that it can have any value (a value of any kind, type)

But am I right in assuming that in SomeApplyType.prototype.ap = function(b), b should be an instance of SomeApplyType?
Brian McKenna
@puffnfresh
yeah
Ludwig Magnusson
@TheLudd
Thanks
Mark Farrell
@markfarrell
Hmm, what have people used fantasyland for so far?
Simon Friis Vindum
@paldepind
I've begun thinking about and writing some code for a library that for converting non-functional libraries to a more functional style. Take a look at it and tell me what you think: https://github.com/paldepind/functionize
If there's anyone who's done a bunch of such conversions before I'd love to get your feedback.
mac10688
@mac10688
paldepind, how would it be different/better than Ramdajs?
Simon Friis Vindum
@paldepind
@mac10688, This is quite different. It's a library for doing on single thing. It has several functions not in Ramda. Some of them are quite powerful but quite specific. And if you write your library transformations with functionize it will depend on a single small library – not a huge general purpose utility belt.
Simon Friis Vindum
@paldepind
@mac10688 you can't do this with Ramda.
Walle Cyril
@GrosSacASac
can somebody explain to me what fantasyland is and why and how to use it ?
mac10688
@mac10688
I think people are using it as a spec sheet to write functional libraries, but I don't know that much either
Scott Sauyet
@CrossEye
@GrosSacASac: Here's my description: FantasyLand offers specifications for a number of abstract data types, at least partially inspired by types from mathematics, either Abstract Algebra (e.g. Semigroup, Monoid) or Category Theory (e.g. Functor, Monad). These specifications really are abstract, defining minimal interfaces and some simple laws for how the methods of the interfaces interact. FantasyLand does not define types such as Maybe, Either, Reader, or other similar ones you may have heard of. But a system that does define one of those can claim adherence to, say, the FantasyLand Functor specification by adhering to the interface and laws defined for Functor. Similarly they can claim adherence to the Monad specification by adhering to the additional rules for Monad. The main point is that users can work with these concrete types in an abstract manner, and there are many useful algorithms that can be written against the more generic specifications. FantasyLand does not attempt to offer any way to prove that a type complies with the specification, but it does give standardized Javascript naming for the methods of these types (which vary from language to language) and manages to offer very minimal laws to enforce.
Roman Pominov
@rpominov
Hi! I am new here so please forgive if I'll ask naive questions. I was thinking wouldn't it be better if fantasy-land spec require more uniq method names? For example take a look at how it was done in transducers protocol (here is the discussion that lead to that final spec cognitect-labs/transducers-js#20). This would serve two purposes: 1) it will be easier to add spec support to existing API, as method names will be guaranteed not taken 2) we could use duck-typing to check if an object implements a spec. For example if an object has .of method we can't tell if it implements fantasy-lend's .of or something else, but if it has a @@fanatsy-land/of we can be pretty much certain :)
Perhaps if the spec would require method names like this it could speed up the adoption.
Hardy Jones
@joneshf
I think the original idea was that there are some built-in objects that already meet the spec (like Array), so choose names inline with those.
Simon Friis Vindum
@paldepind
@joneshf, as far is I know map is the only method implemented by any built-in object.
If the current spec becomes widespread all the names used will be unavailable to anything but fantasy land implementations. In the same way that Promises/A+ "stole" then from everybody.
But that made more sense since your supposed to call then in everyday code. Not so with the fantasy land methods.
Hardy Jones
@joneshf
@paldepind concat as well, reduce/reduceRight if we ever settle on what to do about Foldable, I think another.
Simon Friis Vindum
@paldepind
@joneshf Yes indeed! I forgot about that.
Hardy Jones
@joneshf
@paldepind why aren't you supposed to use fantasyland in everyday code?
Simon Friis Vindum
@paldepind
I at least can't see myself doing it. I don't write functions over monads on a day to day basis.
Hardy Jones
@joneshf
oh
Simon Friis Vindum
@paldepind
@joneshf Do you do that?
Hardy Jones
@joneshf
yes
Simon Friis Vindum
@paldepind
Nice. What am I missing?
Hardy Jones
@joneshf
you do as well, you just don't know it ;)
actually, that sounds pretty condescending
sorry
Simon Friis Vindum
@paldepind
None taken :)
Hardy Jones
@joneshf
do you use map?
Simon Friis Vindum
@paldepind
A LOT!
Hardy Jones
@joneshf
well that's Functor stuff
have you used concatMap?
or maybe a map followed by a flatten?
Simon Friis Vindum
@paldepind
Sure, but I never call map of objects. I use a map implementation that delegates to the map of fantasy land compatible objects.
And that's what I mean when I say you won't call these functions on a day to day basis.
Hardy Jones
@joneshf
ah, i see