Make constructors curried
See original GitHub issueIt 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:
- Created 6 years ago
- Comments:10 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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 useR.curry
(instead ofR.curryN
).@safareli In my experience, using arguments is usually faster.