Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The Frege page says that Frege features

    Higher rank types
but says nothing about higher-kinded types (HKTs). The two are different. The rank of a type describes the depth at which universal quantifiers appear contravariantly. This is quite different from higher-kinded types, which allow type-level computation. For good monad support one uses HKTs. I wonder if Frege has HKTs and the description on the original page made a mistake?


It has both.

Somewhere it is said that it has all language features of Haskell 2010. This implies higher kinded types.

But in addition to Haskell 2010, Frege has also higher rank types.


Thanks.

Type inference for types of rank > 2 is undecidable, how does this go together with the claim that Frege has type inference? I'm not a Haskell expert, but I think the

    {-# LANGUAGE RankNTypes #-} 
extension enables HRTs in Haskell too.


Type inference for higher ranks is in fact undecidable, but not type checking. Hence, exactly like in Haskell with RankNTypes, you need to annotate your higher rank functions.

Actually, the Frege compiler employs an algorithm described in Simon Peyton-Jones paper "Practical Type Inference for Higher Ranked Types". Ordinary HM types are inferred, and higher ranked types checked.


Thanks. It's great to have basically Haskell on the JVM. I'll give it a try.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: