LINUX.ORG.RU

История изменений

Исправление fulmar_lor, (текущая версия) :

В штонах у тебя просто дикшенари.

https://limo.libis.be/primo-explore/fulldisplay?docid=LIRIAS1656272&context=L&vid=Lirias&search_scope=Lirias&tab=default_tab&lang=en_US&fromSitemap=1

>Wadler and Blott formalise type classes in their 1989 paper using a translation to
>a standard Hindley-Milner typed functional language [46]. This translation is known
>as the dictionary translation and not only serves as an implementation strategy, but
>also gives an accurate semantic model of type classes. A type class is modelled as
>a dictionary record type, with the type class operations as record fields. Instances
>become record values containing the definitions in the instance as fields.

data Eq t = EqDict {equal :: t → t → Bool}
data Ord t = OrdDict {eqDict :: Eq t, compare :: t → t → Ordering}

Тайпклассы – это constraint в первую очередь.

Хренейнт. SomeClass a =>- это просто ещё один аргумент функции, значение которого (инстанс) должен передаваться неявно (или явно, если хочется). Новые сущности выдумывать не нужно ибо получится убогий хаскелль:

>Apart from the automatic inference of instances, the dictionary model has many
>advantages over the standard type class system. All the power of normal language
>record mechanisms is available, and they can be defined, manipulated and abstracted
>over in standard ways.

Публикуй ссылку на документ с дизайном, мы посмотрим.

В процессе разработки. Идеи пишу в этом треде

Исходная версия fulmar_lor, :

В штонах у тебя просто дикшенари.

https://limo.libis.be/primo-explore/fulldisplay?docid=LIRIAS1656272&context=L&vid=Lirias&search_scope=Lirias&tab=default_tab&lang=en_US&fromSitemap=1

>Wadler and Blott formalise type classes in their 1989 paper using a translation to
>a standard Hindley-Milner typed functional language [46]. This translation is known
>as the dictionary translation and not only serves as an implementation strategy, but
>also gives an accurate semantic model of type classes. A type class is modelled as
>a dictionary record type, with the type class operations as record fields. Instances
>become record values containing the definitions in the instance as fields.

data Eq t = EqDict {equal :: t → t → Bool}
data Ord t = OrdDict {eqDict :: Eq t, compare :: t → t → Ordering}

Тайпклассы – это constraint в первую очередь.

Хренейнт. Констрейнт - это просто ещё один аргумент функции, значение которого (инстанс) должен передаваться неявно (или явно, если хочется). Новые сущности выдумывать не нужно ибо получится убогий хаскелль:

>Apart from the automatic inference of instances, the dictionary model has many
>advantages over the standard type class system. All the power of normal language
>record mechanisms is available, and they can be defined, manipulated and abstracted
>over in standard ways.

Публикуй ссылку на документ с дизайном, мы посмотрим.

В процессе разработки. Идеи пишу в этом треде