just => fucking => use => “them”;

just => fucking => use => “them”;

Is equivalent to:

function (just) {

return function (fucking) {

return function (use) {

return “them”;

}

}

}



7 thoughts on “just => fucking => use => “them”;

  1. Haskell has an arrow notation language extension, which is a kind of syntactic sugar for function composition. Ordinarily you can use the dot (.) operator to compose functions from right to left, and the (>>>) operator is (.) with parameters flipped, so you can write:

    (+ 1) >>> (* 3) >>> print

    which would create a function equal to:

    x -> print ((x+1)*3)

    But this seems to be different from how JavaScript arrows work.

    Like

  2. Ramin Honary​​​ this looks a lot like the type signatures in Haskel. The main thing is that it is a curried function which creates closures to enable access to the earlier args.

    Like

  3. John Hardy not a Turnbull fan Oh, I get it. In Haskell, all functions are curried by default. So JavaScript had it’s syntax expanded to allow you to define curried functions.

    So the example they gave appears to be what is called an “Endofunctor”:

    const composeMixins =

    (…mixins) =>

    ( instance={},

    mix = (…fns) => x =>

    fns.reduce(

    ((acc, fn) => fn(ac)),

    x

    )

    ) =>

    mix(…mixins)(instance);

    translated to Haskell would probably be something like:

    composeMixins = mixins ->

    let instance = mempty

    mix = fns -> x ->

    foldr ($) x fns

    in mix mixins instance

    where ($) is the application function, which is equivalent to JavaScript

    ((acc, fn) => fn(acc))

    And, just FYI, the Haskell equivalent I wrote up above could be further simplified to this:

    composeMixins =

    foldr ($) mempty

    Like

  4. That’s clever stuff. Consider me 5% along the path of understanding this shit.

    Have you looked at PureScript? Seems Haskelish. I couldn’t understand much from their home page.

    Like

Leave a comment