Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2000-09-28 13:04:14 by simonpj] · 861e836e
    Simon Peyton Jones authored
    ------------------------------------
    	   Mainly PredTypes (28 Sept 00)
    	------------------------------------
    
    Three things in this commit:
    
    	1.  Main thing: tidy up PredTypes
    	2.  Move all Keys into PrelNames
    	3.  Check for unboxed tuples in function args
    
    1. Tidy up PredTypes
    ~~~~~~~~~~~~~~~~~~~~
    The main thing in this commit is to modify the representation of Types
    so that they are a (much) better for the qualified-type world.  This
    should simplify Jeff's life as he proceeds with implicit parameters
    and functional dependencies.  In particular, PredType, introduced by
    Jeff, is now blessed and dignified with a place in TypeRep.lhs:
    
    	data PredType  = Class  Class [Type]
    		       | IParam Name  Type
    
    Consider these examples:
    	f :: (Eq a) => a -> Int
    	g :: (?x :: Int -> Int) => a -> Int
    	h :: (r\l) => {r} => {l::Int | r}
    
    Here the "Eq a" and "?x :: Int -> Int" and "r\l" are all called
    *predicates*, and are represented by a PredType.  (We don't support
    TREX records yet, but the setup is designed to expand to allow them.)
    
    In addition, Type gains an extra constructor:
    
    	data Type = .... | PredTy PredType
    
    so that PredType is injected directly into Type.  So the type
    	p => t
    is represented by
    	PredType p `FunTy` t
    
    I have deleted the hackish IPNote stuff; predicates are dealt with entirely
    through PredTys, not through NoteTy at all.
    
    
    2.  Move Keys into PrelNames
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    This is just a housekeeping operation. I've moved all the pre-assigned Uniques
    (aka Keys) from Unique.lhs into PrelNames.lhs.  I've also moved knowKeyRdrNames
    from PrelInfo down into PrelNames.  This localises in PrelNames lots of stuff
    about predefined names.  Previously one had to alter three files to add one,
    now only one.
    
    3.  Unboxed tuples
    ~~~~~~~~~~~~~~~~~~
    Add a static check for unboxed tuple arguments.  E.g.
    	data T = T (# Int, Int #)
    is illegal
    861e836e