Skip to content

Comment on Making Map Operations Implicit in Programming

Comments

How difficult will code be to read if implicit operations are happening without any mention of the language construct executing them? As far as this goes, Haskell's Maybe monad is the simplest system I've ever seen:

  let x = Just 3 in
  do
   value <- x
   guard (value > 1)
   return (value * 4)
If x was 'Nothing' then the whole operation would short circuit and 'Nothing' would be returned. If the guard fails, then 'Nothing' is returned.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.