Re:Static typing will not save us from broken software
by dllthomas on Tuesday October 25, 2016 @03:13AM
(#12785885)
If you require a constraint to be able to provide Default values (even if every type in fact implements Default - c.f. Typeable) then for Tuple in particular there is only the correct implementation (modulo bottom or hidden side-effects).
I would love to see tests at the interface level (or typeclass level for Haskellers) rather than the implementation level, to enforce that all implementations of an interface satisfy laws like this. In Haskell, this would mean that you could enforce things like monadic laws which we all assume to be true anyway.
[1] https://www.youtube.com/watch?v=JMP6gI5mLHc