Alice ✨
banner
welltypedwit.ch
Alice ✨
@welltypedwit.ch
When the limestone of imperative programming has worn away, the granite of functional programming will be revealed underneath -Simon Peyton Jones

https://welltypedwit.ch
(e.g. here d__0 is private and the function only returns it as an IEnumerator)
sharplab.io#v2:CYLg1APgA...
SharpLab
C#/VB/F# compiler playground.
sharplab.io
November 12, 2025 at 6:46 PM
it's probably because it would need to expose the underlying struct that it would use for that enumerator? if you use yield return normally, it can hide the internal class behind the IEnumerator interface, but with a struct that would still incur an allocation :/
November 12, 2025 at 6:46 PM
it's from HashMap.Strict so i would hope it forces the elements? but in any case, these hashmaps aren't large enough (and definitely don't have enough collisions) for me to care about that here ^^

the actual issue is much worse
bsky.app/profile/did:...
yes!! the `deriving newtype Monoid` also derives `mappend` so `mappend` is the `HashMap` mappend, not (<>)
November 12, 2025 at 4:07 PM
yes!! the `deriving newtype Monoid` also derives `mappend` so `mappend` is the `HashMap` mappend, not (<>)
November 12, 2025 at 4:03 PM
lean fixes this

(sorry)
November 12, 2025 at 1:22 PM
(or if you think that transformers is *slower* than mtl for that matter)
November 12, 2025 at 10:39 AM
literally their first example of gleam code is doing an unchecked side effect!
November 12, 2025 at 10:12 AM
gleam isn't pure though
November 12, 2025 at 9:21 AM
should have said react...
November 12, 2025 at 1:46 AM
what are they saying?
November 11, 2025 at 11:03 PM
i’d even settle for js or python
November 11, 2025 at 10:54 PM
idk, they seem kind of heteronormative
November 11, 2025 at 9:51 PM
js
November 11, 2025 at 7:32 PM
"the first constructor initialized to all defaults" definitely fits that criterion, even for errors
November 11, 2025 at 10:38 AM
in this case, your default value isn't supposed to be semantically meaningful (because that depends on the context), it's supposed to be a default value in the sense that it's definitely valid and can always be trivially constructed.
November 11, 2025 at 10:38 AM
"sensible defaults" don't exist in a vacuum anyway. what can be a default value always depends on the operation you're trying to do on it (that's why a Default type class is such a silly idea).
November 11, 2025 at 10:38 AM
it's not but it's also really not that important tbh (like, most languages get by just fine without it)
November 11, 2025 at 10:31 AM
it can be the first constructor all initialized to default values?
November 11, 2025 at 10:31 AM
alternatively dereferencing null can just return the default value
November 11, 2025 at 10:20 AM
i mean yeah, treating null as a reference to <statically known address of one large array of zeroes> doesn't seem very convoluted?
November 11, 2025 at 10:18 AM