An overview of algebraic laws from the perspective of a functional programmer. I've used a Haskell-esque syntax for the definitions of the laws and examples.
name | definition | example |
---|---|---|
Identity [¹][] | f x = x |
add 0 42 = 42 |
-- Create our directories table. | |
CREATE TABLE `directories` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) DEFAULT NULL, | |
`lft` int(11) NOT NULL, | |
`rgt` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `directory_lft` (`lft`), | |
UNIQUE KEY `directory_rgt` (`rgt`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |