News for hackers. Stuff that matters.
Re:Functors, Applicatives, and Monads by hajile on Sunday March 30, 2025 @03:38PM (#43526893)
Functions are just containers of calculations (the whole “code is data”).

I don’t know why lists as values in a container would be confusing. Lots of very popular languages literally have box types which may not be exactly the same, but show that expecting containers to potentially commission complex data isn’t unusual.

Re:Functors, Applicatives, and Monads by fn-mote on Sunday March 30, 2025 @04:53PM (#43527530)
> I don’t know why lists as values in a container would be confusing.

The GP makes it pretty clear - the misunderstanding is that there is one value in a container. A list has many.

Re:Functors, Applicatives, and Monads by hajile on Tuesday April 01, 2025 @09:34AM (#43546617)
That's like saying a dev would be confused that an Object can contain a list. I can't see that tripping up anyone but the most junior of developers.
Re:Functors, Applicatives, and Monads by codebje on Sunday March 30, 2025 @07:43PM (#43528989)
One source for confusion around lists is that the list monad is often used to model non-determinism, rather than just "many things". If you're thinking about non-determinism, a list is akin to a container of one item when you don't precisely know which item it is, but do know it's one of zero or more candidates.

The most widely recognised example, IMO, would be monadic parser combinators. "A parser for a thing, is a function from a string, to a list of pairs of strings and things."