Hacker News new | past | comments | ask | show | jobs | submit | icrbow's comments login

Not for long.

> does Haskell have a special construct that allows for values to be overwritten

Yes and no.

No, the language doesn't have a special construct. Yes, there are all kinds of mutable values for different usage patterns and restrictions.

Most likely you end up with mutable containers with some space reserved for entity state.

You can start with putting `IORef EntityState` as a field and let the `update` write there. Or multiple fields for state sub-parts that mutate at different rates. The next step is putting all entity state into big blobs of data and let entities keep an index to their stuff inside that big blob. If your entities are a mishmash of data, then there's `apecs`, ECS library that will do it in AoS way. It even can do concurrent updates in STM if you need that.

Going further, there's `massiv` library with integrated task supervisor and `repa`/`accelerate` that can produce even faster kernels. Finally, you can have your happy Haskell glue code and offload all the difficult work to GPU with `vulkan` compute.


> ECS library that will do it in AoS way

TLAs aren't my forte. It's SoA of course.


> Flame bait

I'll take it.

> ChatGPT is the new techno-atheist's substitute for God

Not really, no ~~true~~ AInotKillingeveryoneIst says that ChatGPT (or GPT-like) is ASI. Please stop beating this particular strawman.


Your second thing-that-looks-like-a-quotation does not appear to be quoted from anywhere. I don't think you should do that.

(I am not sure whether your last line is your actual opinion or sarcastic, given the "no true ..." phrasing, but for what it's worth I think it's unironically correct: no one with any brain thinks ChatGPT is anything much like a superintelligence. There are people who expect AI to become godlike, for better or for worse, but the most they're saying about the likes of ChatGPT in this connection is "progress sure seems to be pretty fast these days".)


Why is this a strawman? Have you seen the Jesus AI on Twitch?

Seriously- Goes way back.

In the movie THX 1138 the population talk to a AI Jesus.


Debug.Trace has a lots of stuff for that. You can even generate charts from that when using eventlog-enabled runtime.


Yes. The amount of job postings raises year to year.


For the reference, 2017 was the year of GHC 8.0. Since your decision to never look back there were a lot of good things.

The standard didn't come out because of some failure to make it. It was mostly the lack of interest that killed it. I wouldn't be betting that some alternative universe where Haskell Prime pulled through had a noticeable increase of adoption because of this.

Looking at proposals, arguments "from standard" don't tend to generate enough support. What wins hearts is alleviating someone's pain without taking disproportionate externalities.


I’ve paid attention to the language since 2017 (it’s kind of impossible not to if you work in the PL research field). I just consider it dead for my own work - that’s the sense in which I haven’t looked back.


I used to wrap everything in Nginx, but `warp` can hold its own candle, with HTTP2 and stuff. One less piece to configure.


You say "by wrapping a value" and then confuse it with the wrapper right away. No, monads are not wrappers. Some wrappers are monads, but not all. inb4, monads are not pipes either.


Sure, a monad is a type constructor. The constructed type allows you to compose transformations.

Each monad constructs a type that behaves differently and expects different things, but in general; the monad is defined by a unit/point/return function which brings a value into the monadic context, and a flatMap function aka bind, which further breaks down to “flatten after map”.

So List[_] is a type constructor, given a type T, it produces a List[T], which defines some transformations. Return creates a single element list, and flatmap takes the A->[B] applies it everywhere and then concatenates.

The nice thing about the wrapper analogy is that even though it is technically wrong, it is easier for people to get it because it follows naturally from OOP and it is a sufficiently useful mental model imho.


IMO the spirit of this answer is a big part of the problem. This might not be exactly what the GP was saying but I've found you can quickly get a dev up to speed with a "good enough" sense of what a monad is. One that'd cover a vast majority of their needs, at least in the early going.

But then there are always people who start popping in and pointing out how those definitions aren't quite right. Which is true. But does it matter *for practical purposes* to give a dev a useful for now mental model that they can then use to figure the rest out later? I'd say no.


Then why not just say that a monad (instance) is a type `t` which implements `bind :: t a -> (a -> t b) -> t b`? It's as down to earth and down to the point as it gets, and each time a new dev thinks out a code path which would lead to `t b` they'd remember `bind`. No need for containers metaphors at all.


This. Just point to the definition in your language (NOT the category theory, unless that's what you're coding in).

In Haskell, a Monad is a type class with a method `bind`. In Scala that would be a `flatten` or whatever.

If a person who's asking doesn't yet know what the "type class" is, or how to read signatures, your "monad tutorial" would not make much sense anywat. Guide them to learn the prerequisites first.


What’s a `type`? What is `t a`? How do I get `t a`? How does `t b` become `b` when I bind again? Where is `b` after I bind? What about the reader monad and the state monad? Those have different signatures, so what gives?


For practical purposes you don't have to know what the monad "is". You need some good practical examples how to wield them.

Knowing some prehistory about doesn't affect usage. And metaphors are very tricky and personal.

The personal part is where the "monad tutorials" fall flat. They assume shared context which may or not may not be actually shared by a random reader on the internet. Yes, some monads are really about "wrapping a value" or whatever.

Reading a post using this metaphor when you want such a wrapping and/or deal with chaining wrappers regularly can bootstrap your understanding in no time. But if you're reading "wrapper"-flavored tutorial while dealing with "pipes" then the spell breaks, you end up confused, and another one joins the "monads are uncomprehensible" group.

Teaching is hard enough. Writing good tutorials is even harder. Successfully giving an universally good drive-by explanation is next to zero probability.

I suspect this is a knowledge variant of "XY problem" and you have to establish more context before answering.

And another problem that "what is a monad" is already a meme. Everyone has the burning desire to ask it, but usually there's no practical need for the answer. Without that confusion ensues. Or, even worse, a false understanding gets locked in and starts to proliferate, sustaining the memetic chain reaction.


The intention of the comment was just to give a good enough model so that devs can just get going :)


Yes, sorry, I was agreeing with you & not the person who responded.


I've seen a company doing that in Visual Basic. It was successful enough to have a nice office etc.


It may be wise. The stack being mainstream is only a part of the equation to consider. It can be easily dwarfed by other variables, like "fun".

E.g. even if "getting your face hit by a brick, hourly" is a more widely demanded skill and has more job openings than Haskell I'd still pick the latter.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: