Re:Goro – An implementation of PHP written in Go
by TheDong on Monday November 26, 2018 @08:19PM
(#18538484)
In many languages invented since c that have errors as values, you can use something akin to a specialized monad to sequence things which may fail together.
For example, in rust you could use:
let res1 = w.Write(...)?;
let res2 = w.Write(res1)?;
In haskell, you can use do notation or monad binding to do a similar thing.
Of course C doesn't have a good type system that allows this sort of thing; it was created before such type systems were well known.
I would expect any modern language to at least recognize that there are good ways to sequence and compose types.
For example, in rust you could use:
In haskell, you can use do notation or monad binding to do a similar thing.Of course C doesn't have a good type system that allows this sort of thing; it was created before such type systems were well known.
I would expect any modern language to at least recognize that there are good ways to sequence and compose types.