
23 Apr
2017
23 Apr
'17
8:29 p.m.
A tuple doesn't only have one value. forall a. ((,) a) only has one value. Fortunately, Haskell has a kind system so we can easily determine what length does.
:k Foldable Foldable :: (* -> *) -> Constraint
Clearly then, if we see a program (length x) where x is a tuple, then we can easily determine that this a constant value 1. For the same reason if we see (length [[1,2,3], [4,5,6]]) and ask, is the length 2 or 6? It's clearly 2; just look at the kind of Foldable. I like types, and types of types. Join me. On 23/04/17 20:06, Jonathon Delgado wrote:
If a tuple only has one value,