@rae: A not-so-quick look at Quick Look impredicativity

preview_player
Показать описание
I introduce the new ImpredicativeTypes extension and show a way to use it to make indexing into binary trees convenient.

Рекомендации по теме
Комментарии
Автор

The issue with defaulting to Any at 5:14 is GHC #19110.

monoidal_
Автор

8:25 that *is* a really nice-looking arbitrary tree of int’s 😄

malkdk
Автор

When I first saw inability to use forall without proper constructor I though there were some idea behind it. E.g. you have to explicitly pack polymorphic type behind something that have interface that allows to manage it without knowing actual type (e.g. using pointer to class with virtual dtor in C++). And you can't use newtype exactly because there is some overhead associated with it.

virkony
Автор

It's great to see a use case for ImpredicativeTypes that is more realistic than "putting ids or lenses in lists"! I'm still left with two questions though:

1) Why can't GHC check list literals but can check explicit uses of (:) and []? Was that just an oversight since the extension is still pretty new?

2) Couldn't you do the same thing without ImpredicativeTypes by defining TreeIndex as a newtype?

welltypedwitch
Автор

In TreeIndex the 'a' looks like it's an existential variable, but I don't think you use that word here. Will this extension allow using existentials where it was not possible before?

mck