Code Monkey home page Code Monkey logo

Comments (4)

ivan-kleshnin avatar ivan-kleshnin commented on August 23, 2024

Error disappears if no currying is present.

// compiles
let filterMatrix = function (v: number, m: Array<Array<number>>): Array<number> {
  return chain((r) => filter((c) => c == v, r), m)
}

Mapping compiles as it should so I guess the problem is with filter definition but I failed to find it

// also compiles
let mapMatrix = function (fn, m: Array<Array<number>>): Array<number> {
  return chain(map((c) => fn(c)), m)
}

from npm-ramda.

KiaraGrouwstra avatar KiaraGrouwstra commented on August 23, 2024

Your hunch was right: the curried filter definition had an issue. Just now it used filter<T>(pred: Pred<T>): <T>(list: List<T>) => T[];, which should have been filter<T>(pred: Pred<T>): (list: List<T>) => T[];.

Note that in the former version the generic was redefined halfway through (no longer the same T!), as a result of which the type variables failed to link up.
Having fixed that, your example type-checks presuming you allow it to find the parameter type for (c) => c == v, using (c: number) => c == v or R.equals(v).

This helped me track down a bunch of related cases of duplicate generics as well. Thank you for reporting this! In fact, this is making me reconsider the 'solution' to #90...

from npm-ramda.

ivan-kleshnin avatar ivan-kleshnin commented on August 23, 2024

@tycho01 thanks for taking time to fix this!

from npm-ramda.

KiaraGrouwstra avatar KiaraGrouwstra commented on August 23, 2024

You're welcome; thank you for your helpful bug reports. :)

from npm-ramda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.