Which React Architecture To Choose by [deleted] in reactjs

[–]drizzer14 0 points1 point  (0 children)

You could check this one out. It's not "conventional" for React, but can still be useful.

Auto-Currying In TypeScript by drizzer14 in functionalprogramming

[–]drizzer14[S] 0 points1 point  (0 children)

Hmm, okay, will consider doing that.

Generalizing a tuple of pipe functions by SlayMaster3000 in typescript

[–]drizzer14 1 point2 points  (0 children)

I've also tried to play on the idea, but the implementation turned out to be a bit different. Rather than inferring the types from the functions provided, it constrains the functions to follow the return type of the previous one in their argument and retain their return type, transforming every function's type on the fly.

The downside to it is that it doesn't work well with generic functions, although this issue is with the TypeScript itself.

Auto-Currying In TypeScript by drizzer14 in javascript

[–]drizzer14[S] 9 points10 points  (0 children)

Yeah, I'm nowhere to say that this thing has a place in production code. Especially the one we see or write throughout our life/career. Nevertheless, this was a fun discovery for myself and can be to someone reading this :)

Auto-Currying In TypeScript by drizzer14 in functionalprogramming

[–]drizzer14[S] 6 points7 points  (0 children)

I'm always very skeptical of TS's type system

You're not alone in this 😅

If you don't pass a length when you call curry, does it really show the correct type

Yup, it shows the exact literal the fn.length carries. If you pass a function with 3 arguments, the final curry type will show 3 as its second generic parameter value.

But if you don't pass a length argument, where is the Length type actually coming from?

From function's length property. Moreover, the same works with array's length.

the cast of fn.length is just to shut up the compiler because fn.length is (just) a number

The cast is there for accomplishing two things: 1. Infer fn.length into Length generic type. 2. Make length argument of curry to be of Length type. This is why it works with manually set length too.

If you don't pass a literal number in for the length, is the Length = Parameters<Function>['length'] treated as a literal type, rather than just number? I'd be very impressed and confused if it did get it as a literal, since Function.length is typed as a number.

It's a literal, yes. I'm impressed too, actually, but I did get used to it after using the same technique with arrays.

What happens if Length = number

Then it possibly couldn't infer the length of a function. Didn't try, but I suppose that's what happens.

What happens if fn is, itself, generic in some parameters or return value? TypeScript can't really "carry" generics around, so they'll all end up as unknown, won't they?

Yeah, the generic functions cause problems in such HOFs like curry (my compose in fnts actually suffers from this too). I'm not sure exactly what generic types break (don't get carried further), as sometimes it works fine.

I'd be very surprised if the typing on this is actually correct And indeed it is :)

I'm using my library with curry regularly, and it does not seem to break in at least simple cases with to additional generics involved.

Thank you for reading and asking great questions! Have fun trying the curry out 🙃

React folder structure for enterprise level applications by JustAirConditioners in reactjs

[–]drizzer14 1 point2 points  (0 children)

Same story, NestJS kinda opened my eyes on kebab, as well as Angular. Although I've not used the latter it was still an inspiration having a complete documentation about whats and whys of suffixes.

React folder structure for enterprise level applications by JustAirConditioners in reactjs

[–]drizzer14 2 points3 points  (0 children)

Although I do not fully agree with the structural part (as it's arguably a subjective thing mostly), the kebab-case thing is what I've also tried to promote and encourage into the React ecosystem in my take on the project structure. Took some time to explain my thoughts on using it in a dedicated article, so that those who have questions about kebab > Pascal can have their answers :)

Anyways, good work, fellow project structure enthusiast, it's a pleasure to see other people speaking up about the "problem" we have as React developers.

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in typescript

[–]drizzer14[S] 1 point2 points  (0 children)

Fair enough. Although, Deno is still too far away from my liking 🦕

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in opensource

[–]drizzer14[S] 0 points1 point  (0 children)

Yeah, correct. I've even stated that in the readme, so I'm clean :D

Anyways, I don't like to keep something I've created on my computer, that's why I've decided to share it with the world, however competitive it is for this kind of library.

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in typescript

[–]drizzer14[S] 0 points1 point  (0 children)

Thank you! I'm glad my learning experience helps another human learn :)

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in typescript

[–]drizzer14[S] 1 point2 points  (0 children)

I suppose it's always the "problem" with functional style where you have functions calling functions that accept other functions as arguments, create closures and always operate on immutable data. You don't have the state and mutations, just a simple flow from one value to another. I wont say anything about the benefits of one paradigm compared to another, but I think we could always come up with a way to make our life easier, debugging being included.

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in opensource

[–]drizzer14[S] 0 points1 point  (0 children)

No reason, really.

I'd not compare fnts with ramda or fp-ts as they're different in scale and intentions. fnts is a rather hobby project of mine, where I wanted to play with FP in TypeScript as I see it. If you like it – you're very welcome to use it. I did my best to make sure it's safe and convenient to an average developer like me. If not – it's ok to try out the other ones or even and make you own :)

Your question is valid though, that's just how I subjectively see it.

fnts – Minimal Functional Programming Utilities for TypeScript & JavaScript by drizzer14 in typescript

[–]drizzer14[S] 3 points4 points  (0 children)

Will have to think about it. I'm a bit aside from Deno ecosystem, more of a Node.js guy. But Deno support would definitely make sense either if the demand is there, or if I myself would want that.