Earlier quoted context omitted.
I just saw a haskell meetup where they're using haskell for devops. Basically static typing the underlying machine configurations. As usual, being an Haskell code, the abstraction is generalized and you can apply the logic on other domains.
Was it https://fugue.co ? I think they use Haskell for their DSL
I tried Haskell for 5 years
111–120 of 273 posts
Re: I tried Haskell for 5 years
#112Earlier quoted context omitted.
Here's a practical application of mfix: mfix $ \threadId -> forkIO $ do -- computation in forked thread forkIO creates a new thread and returns its thread id. However, in order to access the returned thread id inside the forked computation, normally one would have to store it in a variable and then read from it inside the thread. mfix, by nature of its laziness, captures the return value of the function passed to it,…
It's a very neat example, and I like it very much as an illustration of mfix, but wouldn't one just use Control.Concurrent.myThreadId for that? Seems a little overkill.
But the general pattern applies to many things. One other example that immediately springs to mind is e.g. registering a callback while needing the ability to unregister the callback from within itself, using some sort of id returned from the registering function.
Re: I tried Haskell for 5 years
#113Earlier quoted context omitted.
> The cool thing about OCaml is that you can actually reason about performance, as long as you ignore memory issues (memory usage, garbage collector runs, etc.). If you ignore mem issues you can also reason about the performance of Haskell :) If we want to reason about perf, I think Rust is currently leading in terms of a modern language that allows perf reasoning.
> If you ignore mem issues you can also reason about the performance of Haskell :) Really? My guess (based on close to complete ignorance) would be that laziness would make reasoning about performance hard. Can you ELI5 why my guess is wrong?
Because of it potentially hogging memory! Now we were told to ignore mem issues by the commenter. I just point out the contradiction.
Re: I tried Haskell for 5 years
#114Earlier quoted context omitted.
> (#1) Time and experience can cover up anything. This is simply not true. Time and experience can never cover up for lack of expressiveness, and expressiveness is one of the biggest selling points of Haskell. In fact, experience can only cover for complexity, and lack of discoverability or intuitiveness. Haskell has all those three flaws, so you see, experience is really needed. > (#2) So does NodeJS and (on an abst…
> Time and experience can never cover up for lack of expressiveness Expressiveness is subjective. Experience can alter one's perception. In fact, time and experience alter the basis of comparisons, from objective comparisons to subjective comparisons. > No, they don't. Javascript and macro Basic do not even have enough expressiveness for supporting the kind of library you'll find in Haskell. You mean you can express…
there are multiple reasons for this, kind've tied together. Whitespace is function application (no parenthesis to keep track of like lisp, or even e.g. c, java, or javascript, when programming in a functional style). Immutability forces you to compartmentalize and compose everything. when everything is a function, function and variable names serve as VERY powerful documentation, especially when combined with haskell's also VERY powerful type system (which e.g. has sum types where most languages do not, which allows for example, defining most error states of program as a data type (which can then derive from any typeclass)).
one of the primary benefits of laziness is to make function composition possible under a wider variety of situations (which also increases expressiveness, at the cost of occasional though not difficult to avoid space leaks)
one joke I've heard is that the ideal haskell program is 20 lines of imports and one line of perl.
Re: I tried Haskell for 5 years
#115Earlier quoted context omitted.
OP here. The point about a learning curve is that Haskell is different from most mainstream programming languages. > > 2. Haskell has some very nice libraries > So does NodeJS and (on an abstract level) Microsoft Word. > Libraries are infrastructures and investments that (like > time and experience) can cover up any shortcomings. Javascript is one of the most widely used languages in the world and MS Word leverages t…
So you understand I was commenting that your post didn't really say much about Haskell (learning curve, libraries, tooling ). What you commented or implied is a bit of current Haskell culture. > I actually like C++ a lot. Haskell is an example of academic carefully crafted language, while C++ is rather a practically driven continuous patchwork (and they are extremities to both ends). I simply find your comparisons od…
Haskell is also a continuous patchwork, just look at the number of deprecated GHC extensions.
Re: I tried Haskell for 5 years
#116Earlier quoted context omitted.
> ... I am a bit lost Google "cognitive dissonance" and the "sunk cost fallacy."
The point of the article was focusing on things to fix. Having used Haskell, there's a great many things that were worth the cost of learning it. For one thing, it's made me a vastly better programmer in other languages. It lets me appreciate better styles of writing code and think outside the box when solving things. Using Haskell also gives me the tools for many projects to write code almost thoughtlessly -- you ca…
That is dangerously close to the infamous "if it compiles, then it works" boast, which Haskellers make all the time (while denying that they make it), demonstrating in the process that they don't write real software, where the defects one encounters are very often of a nature such that the program behaves exactly as intended by its authors, but the intended behavior is itself wrong. How does the type system help here?
My comment wasn't glib. I actually think those phenomena quite well explain much Haskell advocacy. Considering how massive an undertaking it is to learn the language and its Byzantinely-complex, PhD-theses-in-disguise libraries (each of which sports a zoo of custom operators) and how small the payoff is, it's unsurprising that those who take the plunge begin zealously encouraging others to do the same, lest their own investment have been for nothing. In a way it's like a conspiracy.
Re: I tried Haskell for 5 years
#117Earlier quoted context omitted.
> The cool thing about OCaml is that you can actually reason about performance, as long as you ignore memory issues (memory usage, garbage collector runs, etc.). If you ignore mem issues you can also reason about the performance of Haskell :) If we want to reason about perf, I think Rust is currently leading in terms of a modern language that allows perf reasoning.
> If you ignore mem issues you can also reason about the performance of Haskell :) Really? My guess (based on close to complete ignorance) would be that laziness would make reasoning about performance hard. Can you ELI5 why my guess is wrong?
But all of that is just because data stays in memory longer than expected.
If you ignore that, laziness has a small performance impact, but it's less than the performance impact of interpreting code, which is something many people consider completely acceptable.
Re: I tried Haskell for 5 years
#118Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…
For instance, if you were to write a CAD program, you probable want to be spending your time thinking about algebra and geometry, and not about little details like how an array is laid out in memory or when memory needs to be freed. The latter might be important for optimizing the last bit of performance out of a tight loop, but a lot of problems are hard enough on their own that just coming up with any solution that works is enough trouble on its own.
It's also good for problems where you want pretty good performance but don't have to be as fast as C, or where you want to take advantage of multi-core parallelism but don't want to deal with the usual complexities of threaded code.
Persistent data structures are really nice for certain kinds of applications, such as web services, where you have some complex internal state that needs to be updated periodically. Error handling is really easy when you can just bail out when something fails, since none of the state was ever modified-in-place and your old pointer to the old state is still valid.
The powerful static type checker makes Haskell a good fit for applications where it's really important that you calculate the right answer, or where you don't want to spend much time tracking down weird bugs.
Haskell isn't so good at applications where you need hard real-time guarantees or you want to have very fine control over the memory layout of your data structures or you want to be able to easily predict CPU or memory usage.
Re: I tried Haskell for 5 years
#119Question to the Haskell experts here. Is Haskell more academic in nature or used heavily in Production environments? Is there an application sweet spot/domain (say Artificial Intelligence/Machine Learning, etc) where it shines over using other languages (I am not talking about software/language architectural issues like type systems or such)? I have no experience with Haskell but do use functional languages such as E…
Re: I tried Haskell for 5 years
#120Haskell: where difficult problems are trivial, and where trivial problems are the subject of ongoing academic research
> and where trivial problems are the subject of ongoing academic research Like what?
EDIT: To be specific, I can think about the example of machine efficiency that can simply be specified literally in C but it is uncertain and opaque in Haskell.