|
|
|
|
|
by 59nadir
3296 days ago
|
|
Surely the proper way to do length is to have it be, essentially: length :: forall f a n. Foldable f => Semiring n => (f a) -> n
`length` is not specific to any one type and it's a complete waste to think of it as something to do with strings in general. They should all just be foldable and that'll give way more.Likewise, they could all just be functors and `map` is free. |
|
What happens if you feel the urge to define several Semirings (or Monoids) on the data type?