[Haskell-beginners] Foldable for (,)

Tony Morris tonymorris at gmail.com
Mon Apr 24 00:29:49 UTC 2017


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,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20170424/52191e27/attachment.sig>


More information about the Beginners mailing list