Opened 10 years ago

Closed 7 years ago

#163 closed defect (wontfix)

Elaboration of class constructors isn't respecting their kinds

Reported by: benl Owned by: amosrobinson
Priority: normal Milestone:
Component: Source Desugarer Version: 0.1.2
Keywords: Cc:

Description

This program should work

class Bag (bag :: % -> * -> *) where
	size 	:: forall a %r1 %r2 
		.  bag %r1 a -(!e1)> Int %r2
		:- !e1 = !Read %r1

instance Bag List where
	size = length

main ()	= println $ show $ size [1, 2, 3];

In the class instance, List has the correct kind, but it's being elaborated to:

instance Bag (List %r1) where
	size = length

which is now an error because (List %r1) has kind * -> * and not % -> * -> *.

The elaborator shouldn't have added the %r1 because that type expression already had the correct kind.

Change History (3)

comment:1 Changed 9 years ago by amosrobinson

  • Owner set to amosrobinson
  • Status changed from new to assigned

Half-fixed: elaborator is not adding region vars if class parameters' kinds start with a region var. Need to think about other cases, e.g.

Foo :: % -> % -> *
class Bag (bag :: % -> *)

instance Bag Foo

then in this case, elaborator should only add one region var: instance Bag (Foo %r1)?

Cf. http://groups.google.com/group/disciple-cafe/msg/c13d24d7009325c8

Last edited 9 years ago by amosrobinson (previous) (diff)

comment:2 Changed 8 years ago by benl

  • Milestone 0.1.3 deleted
  • Priority changed from blocker to normal

comment:3 Changed 7 years ago by benl

  • Resolution set to wontfix
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.