Re:Things that Idris improves things over Haskell
by 59nadir on Saturday June 17, 2017 @03:11AM
(#14574691)
I'm not sure I follow, sorry. The line says that we also pledge to produce a Semiring from this Foldable structure. Given it's a length function it's about as general a specification I think you can give it without becoming something completely different.
[ Parent
| on HN ]
Re:Things that Idris improves things over Haskell
by mcguire on Saturday June 17, 2017 @11:51PM
(#14578872)
To the first question, a Semiring has two operations, + and × conventionally (along with ...). That seems to be more than length needs. A Monoid is just an operation and its identity, which should be exactly what you need for length.
For the second question, traditional (+,×,...) is a Semiring for integers; so is (&,|,...) (bitwise boolean operations). How can you define both Semiring implementations without getting them confused?
There is another reply to my comment that I haven't digested yet. Maybe it answers the second.