Re: [stack] Type for row based languages

John Nowak <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
One more thing I should've mentioned. You state that your type system  
is compositional. I should note that you can get this quite easy by  
extending HM with row types and omitting any equivalent to let  
polymorphism. For example, 'dup apply' would fail to type:

     A b -> A b b
            C   (C -> D) -> D

     A (C -> D) -> A (C -> D) (C -> D)
                   C          (C -> D) -> D

     -- error: C occurs in A (C -> D)

Luckily (for some definition of "luck"), something like '[id] dup  
apply' would fail as well:

     A -> A (B -> B)
          C d        -> C d d

     A -> A (B -> B)
          C (B -> B) -> C (B -> B) (B -> B)

     A -> A (B -> B)
          A (B -> B) -> A (B -> B) (B -> B)

     A -> A (B -> B) (B -> B)

     A -> A (B -> B) (B -> B)
          C          (C -> D) -> D

     A -> A (D -> D) (D -> D)
          C          (C -> D) -> D

     A -> A (C -> C) (C -> C)
          C          (C -> C) -> C

     -- error: C occurs in A (C -> C)

For all expressions that do yield valid types, the order in which you  
infer the type does not matter.

Apologies if I'm stating the obvious.

- John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.