Ticket #74 (closed defect: fixed)

Opened 8 years ago

Last modified 7 years ago

Finish implementation of constructor classes

Reported by: benl Owned by:
Priority: normal Milestone: 0.1.5
Component: Source Type Inferencer Version: 0.1.2
Keywords: Cc:


Added by Jared

The following function causes the compiler to panic.

example = map id 0

The error message is

DDC: error in stage solve
PANIC in Type.Squid.Class
        mergeClassesT: [% -> *, * -> *]

This should fail with a class error stating that Int is not an instance of Functor. When type classes are fully working, it should complain that it could not deduce class Functor from context Num.

Kind inference and constructor classes aren't finished yet - so there'll be lots more panic s where this came from.

Change History

Changed 7 years ago by benl

  • status changed from new to closed
  • resolution set to fixed

In the Functor class we have

class Functor (f :: * -> *) where
	map 	:: forall a b !e1 $c1
		.  (a -(!e1 $c1)> b) -> f a -(!e2 $c2)> f b
		:- !e2 = !{ !ReadT (f a); !e1 }
		,  $c2 = f : $c1

This type requires the second argument of map to be a constructor (f) applied to a type (a), so f :: * -> *. If we apply this to 0, that has type Int32 which has kind % -> *, so we get a kind error.

Note: See TracTickets for help on using tickets.