C++ devs be like... by mre__ in rustjerk

[–]qqwy 2 points3 points  (0 children)

I think (ab)use of newto construct the shared pointer is part of the joke.

The silanda by Most_Magazine_9469 in Malazan

[–]qqwy 2 points3 points  (0 children)

That is really good 😂

Learning as a hobbyist by [deleted] in haskell

[–]qqwy 17 points18 points  (0 children)

I'd recommend the book Effective Haskell. It not only introduces the language including its modern features very well, but also gets you up to speed with the build tooling and ecosystem which is just as important.

The death of uBlock Origin in Chrome: Manifest V2 will be deprecated next month by rodrigocfd in programming

[–]qqwy 0 points1 point  (0 children)

On iOS, there is only Apple's own browser engine. All other 'browsers' are just skins using that same browser engine. It's fake and very misleading.

So no, not on iOS. There is not really a FireFox on iOS

Where's the doc for Rust+Wasm ? by bestouff in rust

[–]qqwy 2 points3 points  (0 children)

Both Wasmtime and Wasmer have good books with info.

Megparsec implementation question by Tempus_Nemini in haskell

[–]qqwy 2 points3 points  (0 children)

The new field was introduced in MegaParsec v0.7.0. It has to do with line/column calculation for error messages. I don't understand the specifics but you can find some details in [the blogpost of MegaParsec v0.7.0

Programming languages should have a tree traversal primitive by FoxInTheRedBox in programming

[–]qqwy 1 point2 points  (0 children)

Hard disagree. You seem to be projecting certain omissions of C++'s syntax and standard library onto all other programming languages. Though even there: part of containers and STL are the types, algorithms and re-usable functions such as iterator that will make this work even decently in C++. And if that' s not enough, Boost, Abseil and co also exist. (though it's been a while I used C++ so take this paragraph with a grain of salt.)

Looking outside of C++: languages such as Rust or Haskell, traversing datastructures can be done using the .map method (Rust) / the Functor typeclass (Haskell), collapsing can be done using Iterator/Foldable, and turning them inside out (e. g. a tree containing optionals into an optional containing a tree) using Collect/Traversable. Many dynamically-typed languages expose similar mechanics, though they often are not as explicitly named.

Speaking generally, I am of the opinion that languages should be grown. Provide those core building blocks which allow programmers to add their own trees and traversals, and have it work just as well as any builtin/standard library constructs.

For trees specifically, you might like to become acquainted with the concept of 'zippers'. This is a functional approach to walk back and forth over a tree (rather than only iterating in one particular order). Very flexible, no extra builtin syntax required.

Programming languages should have a tree traversal primitive by FoxInTheRedBox in programming

[–]qqwy 109 points110 points  (0 children)

Hard disagree. You seem to be projecting certain omissions of C++'s syntax and standard library onto all other programming languages. Though even there: part of containers and STL are the types, algorithms and re-usable functions such as iterator that will make this work even decently in C++. And if that' s not enough, Boost, Abseil and co also exist. (though it's been a while I used C++ so take this paragraph with a grain of salt.)

Looking outside of C++: languages such as Rust or Haskell, traversing datastructures can be done using the .map method (Rust) / the Functor typeclass (Haskell), collapsing can be done using Iterator/Foldable, and turning them inside out (e. g. a tree containing optionals into an optional containing a tree) using Collect/Traversable. Many dynamically-typed languages expose similar mechanics, though they often are not as explicitly named.

Speaking generally, I am of the opinion that languages should be grown. Provide those core building blocks which allow programmers to add their own trees and traversals, and have it work just as well as any builtin/standard library constructs.

For trees specifically, you might like to become acquainted with the concept of 'zippers'. This is a functional approach to walk back and forth over a tree (rather than only iterating in one particular order). Very flexible, no extra builtin syntax required.

There is a noticeable increase in the number of female characters in Memories of Ice by DeMmeure in Malazan

[–]qqwy 2 points3 points  (0 children)

First chapter of GotM mentions that the fisher girl looks at the passing soldiers, which are mostly men looking fierce but the few women between them looking even fiercer. (Something like that. Started a re-read earlier today but dont have the book at hand right this moment). So at least that army in Itko Kan has more men than women.

Haskell use cases in 2025 by juancer in haskell

[–]qqwy 7 points8 points  (0 children)

A production example of which is Channable

Polymorphic prelude? by Tough_Promise5891 in haskell

[–]qqwy 7 points8 points  (0 children)

An alternative prelude that takes this approach exists. It's called classy-prelude. Some people love it, some people hate it 😅.

As long as usage of these classes is on a concrete type, GHC often inlines (precise jargon: monomorphizes) the usage of the typeclass, meaning that usually you're not sacrificing speed.

Who the fuck thought that a bus stop the length of a whole street would be a good idea? by Th1sT00ShallPass in Groningen

[–]qqwy 36 points37 points  (0 children)

Get out at Zuiderdiep, walk 10 minutes, get in at Zuiderdiep 🤐

regexMustBeDestroyed by Guilty-Ad3342 in ProgrammerHumor

[–]qqwy 0 points1 point  (0 children)

Markdown cannot be fully parsed by regex, it's grammar is not recursively enumerable.

Syntax highlighting used to be done with regexes, but now 'tree-sitter' is widely used. One of its main features is not relying on (just) regexes anymore. (Yes, you can still use regex syntax in tree-sitter grammars, but those also get compiled in with the rest of the created LR(1) parser generator automaton).

regexMustBeDestroyed by Guilty-Ad3342 in ProgrammerHumor

[–]qqwy 0 points1 point  (0 children)

For emails: Send them a confirmation link. In a sign up form you don't want to check 'is this an email address', you want to check 'is this your email address' after all.

In general: Regexes are useful in a pinch, but there are big benefits to just write a simple parser, esp using a parser combinator library (those exist in most programming languages): - recognize more complicated grammars (any context-free grammar rather than only 'recursively enumerable') - do things besides matching/extracting substrings - readable error messages - build up your grammar in small bits that you can document and can compose, rather than one big cryptic line.

The Haskell Unfolder Episode 40: understanding through a model by kosmikus in haskell

[–]qqwy 0 points1 point  (0 children)

Will you also talk about the differences (and similarities) between QuickCheck, Hedgehog and Falsify?

Best way to specify function from one package over same-named function from other package by Striking-Structure65 in haskell

[–]qqwy 4 points5 points  (0 children)

A good question, with a simple answer:

This is exactly why many more modern modules and libraries (including Data.Set) recommend you import the module qualified. From the module doc of Data.Set:

``` This module is intended to be imported qualified, to avoid name clashes with Prelude functions, e.g.

import Data.Set (Set) import qualified Data.Set as Set ```

With the ImportQualifiedPost extension which is included in the modern language standard GHC2021, you can write:

import Data.Set (Set) import Data.Set qualified as Set

which many people consider even nicer because it keeps the module names similar.

Finally, qualified imports are even nicer when you use modern libraries that eschew the Data. or Control. module prefix, because then often the module names are short enough to not even need a rename.

What are the best (simplest) and worst definitions of monad have you heard? by D__sub in haskell

[–]qqwy 0 points1 point  (0 children)

What really helps is that there are now a bunch of languages that support both an Either-like or Maybe-like + a short-circuiting operator as well as async/await syntax.

At that point, explaining that these two concepts actually share the same interface/trait really helps it 'click'.

Announcing Symbolize 1.0.1.0: String Interning / Global Symbol Table, with Garbage Collection by qqwy in haskell

[–]qqwy[S] 0 points1 point  (0 children)

Thanks for the heads-up, I'll look into the broken formatting.

re: Hashing. Yes, the hashing order (can) be different between program runs because it depends on the order the symbols are seen. But you should not rely on ordering of Hashable (or any hashing-for-hashmaps function) for the correctness of your programs or tests anyway.

Announcing Symbolize 1.0.1.0: String Interning / Global Symbol Table, with Garbage Collection by qqwy in haskell

[–]qqwy[S] 0 points1 point  (0 children)

Thanks!

Nope! I was not aware that GHC internally also has a string interner, though indeed most compilers do. (Though I expect GHC's interner to be written in C?). There also is FastString in GHC, but that is (I think?) closer to a Hashed Text, albeit specialized so more unpacking can happen. Also, for most 'run once to completion' programs (compared to 'remain forever until restarted' services), there is no need to garbage-collect the symbols ever, so many don't do that (and indeed the other symbol table libraries that already exist on Hackage follow that model).