[HN Gopher] Examples of Incorrect Abstractions in Other Languages ___________________________________________________________________ Examples of Incorrect Abstractions in Other Languages Author : bshanks Score : 29 points Date : 2020-05-18 18:25 UTC (1 days ago) (HTM) web link (www.reddit.com) (TXT) w3m dump (www.reddit.com) | bedobi wrote: | Null and exceptions. (in Haskell, Maybe and Try/Either) | lhorie wrote: | Fun trivia, the promise absorption thing was dismissed when it | was brought up, with the argument that the "ship had already | sailed on that" and that the arguments for supporting promises of | promises were too academic (in the detractors' words, it was | "fantasy land"). | | Which then resulted in the creation of a specification called | fantasy-land[1] as a form of mockery towards the "incorrect | abstractions are fine" attitude. The goal of this spec is to | standardize on functional algebra nomenclature in JS. | | [1] https://github.com/fantasyland/fantasy-land | christophilus wrote: | > 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. | outworlder wrote: | > 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. | bedobi wrote: | Have a look at Kotlin with the Arrow library, it's a great | compromise | D13Fd wrote: | It's threads like this that remind me how little I know... ___________________________________________________________________ (page generated 2020-05-19 23:00 UTC)