Representation of monadic effects in the non-monadic form
Modern programming relies heavily on effects systems. In the context of the development of programming languages, two approaches to understanding effects are distinguished: the first recognizes an effect as a characteristic of a program that affects the execution environment, separating it from a si...
Збережено в:
| Дата: | 2024 |
|---|---|
| Автор: | |
| Формат: | Стаття |
| Мова: | Ukrainian |
| Опубліковано: |
PROBLEMS IN PROGRAMMING
2024
|
| Теми: | |
| Онлайн доступ: | https://pp.isofts.kiev.ua/index.php/ojs1/article/view/627 |
| Теги: |
Додати тег
Немає тегів, Будьте першим, хто поставить тег для цього запису!
|
| Назва журналу: | Problems in programming |
| Завантажити файл: | |
Репозитарії
Problems in programming| Резюме: | Modern programming relies heavily on effects systems. In the context of the development of programming languages, two approaches to understanding effects are distinguished: the first recognizes an effect as a characteristic of a program that affects the execution environment, separating it from a simple calculation (that is, effects are not taken into account in the system of language types, which is typical for imperative programming languages); the second considers an effect as an aspect of program interpretation that affects the process of its interpretation (such effects are considered in the type system as higher-order types, and this approach is characteristic of functional programming). In industrial programming, the first approach is preferred because of its efficiency in rapid development and less complex concepts. However, this leads to the loss of the possibility of automatic analysis of effects using type systems and increases the difficulty of finding errors. Monads are a convenient tool for describing effects because they have a built-in computation composition operation and can sink values into the monadic environment. A direct contextual representation of effects can be useful for application developers because it reduces cognitive load from syntactic noise while preserving information about effects in data types. This representation also allows for cross-platform applications that can use both monadic and non-monadic effect systems. The paper describes the ergonomic programming language interface for working with monadic effects, which encapsulates the logic of computation and associated non-computational operations in the effect system monad, and describes the direct context encoding technique. The translation of the direct context encoding into the monadic form is implemented in the form of a Scala compiler plugin, which is available as an open source. The use of conditional effects compilation to organize cross-platform interfaces that combine different methods of implementing effects on different platforms is also discussed.Prombles in programming 2024; 2-3: 116-123 |
|---|