3 ms·
Yeah, this is why I love Haskell's type system. You'd be able to implement that as a Maybe [WifiResult], maybe Just a list of wifiresults or maybe Nothing, cop
by lsb 15y ago
Yeah, this is why I love Haskell's type system.
You'd be able to implement that as a Maybe [WifiResult], maybe Just a list of wifiresults or maybe Nothing, copying directly, but you'd probably want to have your datatype be Either String [WifiResult], either you get on the Left an error string or on the Right the list of wifiresults.
- Deestan 15y agoAnd more importantly, if a function has [WifiResult] as the defined return type, you can be absolutely definitely sure that you get a list back. This is not something inherently unique to Haskell. Any strictly typed language could easily have chosen to not let null be a member of all classes. Or at the very least add some "non-nullable" qualifier to types.
- gcb 15y agomaybe I like this