F # Calculations Expressions hide the complexity of monadic syntax behind a thick layer of syntactic sugar. Is there something similar in Scala?
I think this is for understanding ...
Example:
val f = for { a <- Future(10 / 2)
But this is really not the case. Is there any better syntax?
for example in haskell you will have
main = do fromHandle <- getAndOpenFile "Copy from:" ReadMode
toHandle <- getAndOpenFile "Copy to:" WriteMode
contents <- hGetContents fromHandle
hPutStr toHandle contents
hClose toHandle
putStr "Done."
this, unlike scala, is not like foreach loops. The Scala syntax seems to be too strong when combined with an understanding of List, which is an understandable concept. This prevents me from writing internal DSLs (monads) that don't look weird.
skyde source share