Re:The Haskell job market has been growing steaily since 2008
by embwbam on Sunday July 16, 2023 @01:33PM
(#36749526)
Yes that’s exactly what the Maybe monad does! It would look like this in Haskell code
doStuff :: Maybe X
doStuff = do
r1 <- cmd1
r2 <- cmd2 r1
…
return rX
Which is syntactic sugar for: doStuff = cmd1 >>= cmd2 >>= …
Re:The Haskell job market has been growing steaily since 2008
by dllthomas on Thursday July 20, 2023 @06:52PM
(#36807852)
A sometimes important difference is that every process in the pipeline is spawned at the start, and may operate on partial input. A function returning Maybe needs to complete before we know whether it returns Just or Nothing, and we can't start the next function until we have the Just in hand, as that's the input to the function.
> Maybe (optionals) - chain steps and abort if any step is empty.
Could this be (remotely) akin to the following shell pattern?
This would either return the result of a successful execution of tje whole pipe, or return at the first command erroring out.Does it make any sense?