4 ms·
It's not abstract correctness, it's satisfying contracts up to an interface. Take `sequence :: Monad m => [m a] -> m [a]` That takes a list of actions and giv
by dllthomas 9y ago
It's not abstract correctness, it's satisfying contracts up to an interface.
Take `sequence :: Monad m => [m a] -> m [a]`
That takes a list of actions and gives us an action that runs each in turn and collects the results in order. The correctness relative to that description is clear regardless of whether each input action is threading state or handling failure or printing to the screen.
- dmitriid 9y agoThen this clearly doesn’t answer the original question, does it?
- deleted 9y ago[deleted]
- dllthomas 9y agoNot on its own. Fortunately, it wasn't the entirety of my answer to the original question. When you're writing something like `sequence`, you don't need to know the implementation of the interface you're working against. As you get comfortable in Haskell, more things are "like `sequence`". There will always be things that aren't - for those, as I said, you should look where the value is consumed. And as I neglected to say, you can always add a type annotation when things get unclear.
- dmitriid 9y agoAh, the old Java adage: any abstraction can be solved with many more layers of abstraction.