Тёмный

Laws! - George Wilson - Compose Melbourne 2018 

Compose Conference
Подписаться 2,7 тыс.
Просмотров 1,7 тыс.
50% 1

Laws!
www.composeconference.org/2018...
Laws, laws, laws. It seems as though whenever we learn about a new abstraction in functional programming, we hear about its associated laws. Laws come up when we learn about type classes like Functors, Monoids, Monads, and more! Usually laws are mentioned and swiftly brushed past as we move on to examples and applications of whatever structure we're learning about. But not today.
In this talk, we'll look more closely at laws themselves. Why should our abstractions have laws? We'll answer this question both by seeing powers we gain by having laws, and by seeing tragedies that can befall us without laws.
We will look at examples of the utility of associativity and identity in working with Monoids. Concretely, appending a collection of lists going from left to right is O(n^2), but associativity gives us the power to append them all in O(n) - while knowing we'll get the same answer. More abstractly, we'll see that without the laws, the number of useful functions we can write in terms of Monoid's interface is severely diminished. Similar arguments, both in the abstract and the concrete, will be made for the Functor laws of composition and identity, and the Monad laws. The common theme is that laws let us get the most out of our abstractions. This is further highlighted by examining Data.Default - a dreaded lawless type class.
Finally, we will make recommendations about how to verify whether the laws pass when one makes an instance of an abstraction, using the testing libraries QuickCheck and checkers.
Goals
An attendee should learn why giving laws to our abstractions helps us work with and understand them. Attendees should leave the talk better equipped to exploit the advantages of these laws and with knowledge of how to test whether they hold.
About George Wilson
George Wilson is an enthusiastic functional programmer from Brisbane, Australia. He works on open source Haskell projects at the Queensland Functional Programming Lab inside Data61. George is a member of the Haskell.org committee, and a Hackage Trustee.

Наука

Опубликовано:

 

10 окт 2018

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 1   
@OliverCaldwell
@OliverCaldwell 5 лет назад
Worth a watch for the "product" joke alone. Even though I'm a weird lispy programmer I really enjoyed this talk. Kinda followed along.
Далее
Conquering fears and slippery slops on two wheels!
00:18
ГРАБИТЕЛЬ ИСПУГАЛСЯ МАМЫ
00:37
Просмотров 117 тыс.
Bidirectional Type Checking
41:31
Просмотров 6 тыс.
Phylogenetic Software in Haskell
22:32
Просмотров 454
The Best Refactoring You’ve Never Heard Of
32:33
Просмотров 14 тыс.
A Simpler Way to See Results
19:17
Просмотров 99 тыс.
Why Does Scrum Make Programmers HATE Coding?
16:14
Просмотров 499 тыс.
Сравнили apple и xiaomi!
0:21
Просмотров 22 тыс.
ОБСЛУЖИЛИ САМЫЙ ГРЯЗНЫЙ ПК
1:00