What is the point of Solo? (beginner question)
Playing around with GHCi I stumbled upon the Solo type (by looking at which types are an instance of Traversable).
Googling tells me that Solo is a singleton tuple, but it is not clear to me what is the usefulness of having a singleton tuple over just an unwrapped value, and if the singleton tuple is important why isn't there some behind-the-scene-syntactic-sugar-magic to use the usual brackets notation for tuples also for singleton tuples?
Thanks in advance for your help!
Posted Mar 12, 2022, 5:50 PM UTC
Basically it's for consistency. If there is a zero tuple
()and n-ary tuples for n >=2(a1, ..., an)then for consistency there really ought to be something that provides a 1-ary tuple. Consistency can be useful for code generation applications, for example. But the occasions where it is actually useful for a user to use it are very few and far between. I've never used it, for example, and I don't expect ever to.Makes sense, thanks