
18 Jul
2013
18 Jul
'13
5:47 p.m.
On 2013-07-18 10:46, harry wrote:
Why not let all types carry the dictionary automatically, or at least every time that it's used, if that would incur a memory/performance penalty? GHC tells me which context to add when it's missing, so it clearly knows.
I'm not sure the claim in your second sentence is true. For example, foo :: a -> a -> Bool foo = (==) bar :: a -> a -> Bool bar = foo GHC (rightly) complains about foo, but makes no complaint about bar. That is, if a thing only works in the presence of a constraint, you need to have that constraint visible in the type, every time, or else downstream dependencies can reasonably make wrong assumptions. ~d