|
|
|
|
|
by lower
1803 days ago
|
|
Yes, types are usually represented by a DAG with sharing. OCaml does so, for example, and I assume ghc does something similar. So, while id id has type ('a -> 'a) -> ('a -> 'a), this is stored in memory by a pointer structure that amounts to let 'b = ('a -> 'a) in ('b -> 'b). The type of id id id would become let 'b = ('a -> 'a) in let 'c = ('b -> 'b) in ('c -> 'c). This grows linearly. If one were to write out the types without sharing then their size would grow exponentially. |
|
Apparently that's been fixed. I can't confirm because that's not something I ever check the type of.