Name: Anonymous 2015-10-14 7:24
Isn't it hilarious? But the real question is, why are Haskallers so stupid? seriously, it's almost like they want to shit all over what took them decades to build...
fold
sure does help a lot: pretty much every agelbraic type can be folded and you can even mechamically derive fold for them too, but why the hell does Foldable
have fucking length
in it? List
keep length
and call the Foldable
equivalent total
or something? Because the name length
implies some sort of sequential linear structure, while a Tree
can be Foldable
too.it's not something you can abstract over with a classYou can if you restricted it to type constructors with kind
*->*
, and Foldable
does just this.class Foldable f where foldr::(a->b->b)->b->f a->b
Foldable
from being a convoluted OVER-ENGINEERED piece of shitware. Foldable
already implies some sort of sequential linear structure, whether it's a tree or not is irrelevant. If it's listable, there is length of it. data Expression = Number Int
| Add Expression Expression
| Minus Expression
| Mult Expression Expression
| Divide Expression Expression
mathematically justified things.Yeah, like Num. All of my category theory books say that numbers must have functions for negation and conversion to strings.
real foldyou mena CATAMORPHISM