Komonády (nejen) pro programátory
Comonads (not only) for programmers
bachelor thesis (DEFENDED)
View/ Open
Permanent link
http://hdl.handle.net/20.500.11956/63761Identifiers
Study Information System: 143936
Collections
- Kvalifikační práce [11242]
Author
Advisor
Referee
Pultr, Aleš
Faculty / Institute
Faculty of Mathematics and Physics
Discipline
Programming
Department
Department of Theoretical Computer Science and Mathematical Logic
Date of defense
4. 9. 2014
Publisher
Univerzita Karlova, Matematicko-fyzikální fakultaLanguage
Czech
Grade
Excellent
Keywords (Czech)
Haskell Agda komonáda zipper derivaceKeywords (English)
Haskell Agda comonad zipper derivativeMonády (a jejich kategorický duál - komonády) jsou důležitým konceptem teorie kategorií a zatímco monády jsou velmi oblíbenými nástroji ve funkcionálních jazycích (hlavně díky jazyku Haskell), komonády se příliš nepoužívají. V této práci prezentujeme definici komonád vhodnou pro potřeby funkcionálního programování a dále uvádíme příklady jejich praktického použití. Jedním z důležitějších příkladů je zipper - struktura, která reprezentuje určitou pozici. Ukážeme, že zipper lze automaticky odvodit pro každý regulární typ a také že tato operace připomíná derivaci z matematické analýzy. Kromě toho také uvádíme několik řešených příkladů v jazyce Haskell, které ilustrují, jak lze komonády použít pro řešení různých problémů. Všechny důkazy v teoretické části jsou provedeny v jazyce Agda a jsou zkontrolovány počítačem. Powered by TCPDF (www.tcpdf.org)
Monads (and their categorical dual - comonads) are important concepts in category theory and while monads enjoy their popularity in functional languages (mainly due to the programming language Haskell), comonads are often forgotten. In this work we present a definition of comonads suitable for programming and give examples of their use. One of the more important examples is zipper - a structure used to represent position. We show that zipper can be automatically derived for any regular type and show that this operation is very reminiscent of derivative from mathematical analysis. We also show worked examples of various problems that comonads can help solve in the language Haskell. All relevant proofs for the theoretical part of this work are machine checked in the language Agda. Powered by TCPDF (www.tcpdf.org)