3 ms·
Two ways: (1) (avoid) something similar to exceptions; (2) (much better) your datatype has an 'invalid' value. See Maybe in haskell, or Option in Scala (I thin
by lallysingh 16y ago
Two ways: (1) (avoid) something similar to exceptions; (2) (much better) your datatype has an 'invalid' value. See Maybe in haskell, or Option in Scala (I think that last one's right...).
- eru 16y agoWith error handling in Haskell your code would look like getData = fetchDataFromSource =<< validateData =<< ProcessData By the way, the original getData with (.) is backwards. It should be: getData = ProcessData . validateData . fetchDataFromSource