2015年6月28日 星期日

[Note] Fighting spam with Haskell

Some note after reading

https://code.facebook.com/posts/745068642270222/fighting-spam-with-haskell/

其中application do-notation


do
  x <- a
  y <- b
  return (f x y)

will translate to

(\x y -> f x y) <$> a <*> b

if x and y are independent!

所以如果沒有dependant關係的operation, 就可以自動dispatch (ex: network resource fetching)! 雖然這更改了預設do-notation的語義, 不過對於developer而言, 可讀性應該大大提高了.

Reference:
HAXL haskell lib

沒有留言:

張貼留言