25 ms·
> And yet, for a long time, it lacked a function analogous to <>, which is strange when considered from a "folds are Applicative" perspective. Man. I enjoyed h
by christophilus 6y ago
> And yet, for a long time, it lacked a function analogous to <>, which is strange when considered from a "folds are Applicative" perspective.
Man. I enjoyed hacking around with Haskell back in the day, but I found it to be a write only language with forms like <> making me stop and stare too often.
Also, after maybe 15 years of working in statically typed languages, I also decided that ultimately, I prefer dynamically typed languages. Still have yet to use my favorite (Clojure) in production, though.
- bedobi 6y agoHave a look at Kotlin with the Arrow library, it's a great compromise
- outworlder 6y ago> Also, after maybe 15 years of working in statically typed languages, I also decided that ultimately, I prefer dynamically typed languages. Still have yet to use my favorite (Clojure) in production, though. I like to have types when I need types. If I want to write a numeric value in a json output I'm creating that will be consumed by some other system, I want that thing to represent exactly that and spit an error if I ever try to assign something else, such as a string. But more than that, it should be easy to define my own types. I need to be able to say, "this number is not just any number, this is actually a temperature measurement in Celsius" or "this is talking about screen coordinates, not world coordinates". And then only be able to send that to the correct functions – or treat as a normal number if I'm doing basic math. But most of the time, most people don't care about types. We want to say "do this operation across all elements of this array". If I trust whatever lower level function that added the properly typed elements in the first place, now I can focus on manipulating them. Glue code is very amenable to dynamic types. Haskell has a very rich type system (maybe too rich?), but it also allows you to say that function receives an A and returns [A]. What's A? If you don't care, you don't care. That's beautiful. And the compiler can even inference some of it for you. Now, if the only thing I have is a poor type system(like Java), then just give me primitives and a struct.
- JCoder58 6y agoYou want F#. > If I want to write a numeric value in a json output I'm creating that will be consumed by some other system, I want that thing to represent exactly that and spit an error if I ever try to assign something else, such as a string https://fsharpforfunandprofit.com/posts/serializating-your-domain-model/ https://fsharpforfunandprofit.com/posts/serializating-your-d... > I need to be able to say, "this number is not just any number, this is actually a temperature measurement in Celsius" https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/units-of-measure https://docs.microsoft.com/en-us/dotnet/fsharp/language-refe...
- whateveracct 6y ago<> is not write-only Just because you used + in grade school doesn't mean it's more intuitive than <>. Your child brain could learn + so your adult one can learn <> The code I work with professionally that makes heavy use of <>, <*>, <$>, and >>= is usually the easiest parts of the codebase. I'm not mathematician. I didn't go to a fancy private school. I didn't learn FP or category theory formally.
- tome 6y agoOP meant <*> but HN ate the star as an italic character
- whateveracct 6y agoAh ok. Well then I'd use multiplication as the analogy there. It was slightly abstract for my child brain but opened up so many possibilities. Applicatives feel like the adult version of that.