Why aren't there existentially quantified type variables in GHC Haskell

前端 未结 2 2044
小蘑菇
小蘑菇 2021-02-07 03:11

There are universally quantified type variables, and there are existentially quantified data types. However, despite that people give pseudocode of the form exists a. Int

2条回答
  •  粉色の甜心
    2021-02-07 03:25

    It is unnecessary.

    By Skolem's Theorem we could convert existential quantifier into universal quantifier with higher rank types:

    (∃b. F(b)) -> Int   <===>  ∀b. (F(b) -> Int)
    

    Every existentially quantified type of rank n+1 can be encoded as a universally quantified type of rank n

提交回复
热议问题