Coder Social home page Coder Social logo

Comments (7)

jameshfisher avatar jameshfisher commented on June 17, 2024

Bear in mind that the right-associative arrow does make sense where currying is actually going on. So Char -> Char -> Char would be the appropriate signature for

//+ char_first :: Char -> Char -> Char
function char_first(c1){
  return function(c2) {
    return c1;
  }
}

(I'm Jameshfisher :)

from typedjs.

Ejhfast avatar Ejhfast commented on June 17, 2024

Right. But knowing whether a function can be curried (like your example) requires a bit of analysis that I'm not currently doing ;-) Maybe an extra feature later on.

from typedjs.

panesofglass avatar panesofglass commented on June 17, 2024

I can't remember the Haskell equivalent exactly, but I think it would be //+ char_first :: Char Char -> Char. Another option, if the delimiter is necessary, might be //+ char_first :: Char * Char -> Char, a la ML.

from typedjs.

goatslacker avatar goatslacker commented on June 17, 2024

//+ add :: Number, Number -> Number currently works.

from typedjs.

panesofglass avatar panesofglass commented on June 17, 2024

Nice!

from typedjs.

DazWilkin avatar DazWilkin commented on June 17, 2024

Love the principle of TypedJS but having some problems using it so, with apologies if I'm being a "DA"....

Does currying work? I tried a simple function:

fnCurry = function (a) { return function (b) { return true; } };

and then used

test = TypedJS.addTest("fnCurry :: Number -> Number -> Boolean", fnCurry);
TypedJS.go([test]);

but it fails 300 times with

Expected "boolean" but returned undefined on input: [62,33]

from typedjs.

goatslacker avatar goatslacker commented on June 17, 2024

No, currying doesn't work :(

from typedjs.

Related Issues (15)

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.