question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make constructors curried

See original GitHub issue

It would be convenient if constructors were curried. (Not by default but when they take less arguments then supposed, like R.curry)

Example:

const Person = daggy.tagged('Person', ['name', 'age'])

const lift2 = (f, x, y) = x.map(f).ap(y)

// this won't work, because Person constructor isn't curried:
lift2(Person, Just('Rick Sanches'), Nothing)

I’ll try to send PR if you like the idea.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
safarelicommented, Nov 20, 2018

@gwn The error is expected https://github.com/fantasyland/daggy/blob/master/test/daggy.js#L19-L29 The pr hasn’t made constructors curried. it made them “curriable”, which means they have length set to number of expected arguments, so you can use R.curry (instead of R.curryN).

1reaction
Avaqcommented, May 7, 2017

@safareli In my experience, using arguments is usually faster.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scala: curried constructors - Stack Overflow
This approach seems a bit tedious and error-prone. I could imagine something like Function.curried, but then for constructors. scala ...
Read more >
C++ Programming Tutorial 87 - Intro To Constructors - YouTube
... Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code "Caleb") - https://calcur.tech/crypto ...
Read more >
javascript - Curry function with function constructor
Shall I make a curry function this way, or is it best to avoid Function constructor in all means? What I want to...
Read more >
Can value constructors in Haskell be curried? - Quora
Yes. Generally, you can manipulate constructors in Haskell just like normal functions. If you define a constructor with multiple fields, it's curried by ......
Read more >
Strange curried case class constructor behaviour - Compiler
If one writes a curried case class constructor, I would assume the second parameter list behaves like the first list, but it doesn't....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found