[jhc] explanation of FrontEnd.KindInfer.constrain

John Meacham john at repetae.net
Tue Mar 18 18:32:21 EDT 2008


On Tue, Mar 18, 2008 at 06:09:22PM -0400, Samuel Bronson wrote:
> I don't understand how FrontEnd.KindInfer.constrain is supposed to
> deal with KindSimple constraints... it doesn't seem to have any way of
> replacing ?? or ? with *. Why not?

that is done in the FrontEnd.Tc.Kind.kindCombine routine. The kind
inference algorithm is based on the impredicative boxy type inferencer
used as the main typechecker.  this is because jhc is going to be a
kind-polymorphic system, much like the Omega language (based on
haskell). That and I find the impredicative boxy typechecking algorithm
quite elegant. And when my moratorium on adding new features ends, I
want to finish support for bang kinds. so, 

data List a = Cons a (List a) | Nil

will actualy declary a type of

List :: forall (k1::**) (k2::**) . \(a::k2) -> k1 

(** is the supersort of boxed (but not necessarily lazy) values.

this means you can have

List * * - lazy list of lazy elements
List ! * - strict list of lazy elements
List * ! - lazy list of strict elements
List ! ! - strict list of strict elements


        John
 

-- 
John Meacham - ⑆repetae.net⑆john⑈


More information about the jhc mailing list