Saltar al contenido ForoHackers

Stop explaining monads with stuffed food. I am tired and I have bought the wrong lunch.

Programación funcionalHaskell
#8490 · · Citar · Denunciar

I have read four cooking comparisons and still cannot tell what Nothing >>= f does. My sandwich is real and currently the only object in the office with a convincing type signature.

#8658 · · Citar · Denunciar

For Maybe, Nothing >>= f gives Nothing without calling f. Just x >>= f gives f x. Your f has to return a Maybe value itself. You can read right past the burrito. The Haskell introduction has the non-edible version.

#8659 · · Citar · Denunciar

Ok @clavo_tibio so Just 8 >>= (\n -> Just (n + 1)) gets me Just 9. Nothing going into the same line gets me Nothing. What part needs hot sauce?

#8660 · · Citar · Denunciar

None. But that particular choice of f cannot fail. A better next stage might be "find the seat next to this one", which sometimes has no answer. Then Nothing can also arise halfway along.

#8661 · · Citar · Denunciar

Wait, "we found the seat but there isn't a seat next to it". THAT I get. Keep the seat. Someone else can have my burrito.

#8662 · · Citar · Denunciar

I have written a Haskell function to tell people there is nowhere to sit. The university buildings will be furious they didn't think of this.

No has iniciado sesión, así que esto se publica como anónimo: no se guarda con ello ninguna cuenta, nombre ni dirección, y no puede llevar enlaces ni imágenes. Inicia sesión o únete para publicar con tu nombre. Los registros de nuestro servidor web guardan la dirección y la hora de cada petición hasta 14 días; para que la tuya no quede en ellos, usa Tor. Para escribir al equipo de forma confidencial, usa el buzón. Firmar como fuente habitual (una clave guardada solo en este navegador)

Enviar tarda unos segundos aquí: tu navegador resuelve antes una prueba de trabajo contra el spam.

Responder