FizzyElt / functional-programming

帶你探索 functional programming
https://fizzyelt.github.io/functional-programming/
MIT License
25 stars 0 forks source link

[semantic] lazy computation & semantic #22

Open dannypsnl opened 1 year ago

dannypsnl commented 1 year ago

考慮

if True || b
  then c
  else d

此程式的 b 與執行順序嚴格的語言對比,是不會執行的,因此若當中有異常發生,程式還是不會出錯,因為並沒有運行 b 的「需要」

這樣的語意差異有好處,讓 Haskell 可以有奇怪的 Stream 定義,其實就是因為 semantic 而自動獲得 co-data

但建模型就變成一個難題,因為傳統的模型作法都是假定某個執行順序,因此考慮了全部的方案,在 lazy semantic 下反倒濾掉太多

TODO: Add references & reframe