1. 25 Oct, 2000 1 commit
  2. 24 Oct, 2000 8 commits
  3. 23 Oct, 2000 5 commits
  4. 20 Oct, 2000 1 commit
  5. 19 Oct, 2000 1 commit
  6. 17 Oct, 2000 3 commits
  7. 16 Oct, 2000 7 commits
  8. 13 Oct, 2000 3 commits
  9. 12 Oct, 2000 5 commits
  10. 11 Oct, 2000 2 commits
  11. 03 Oct, 2000 2 commits
    • qrczak's avatar
      [project @ 2000-10-03 14:35:31 by qrczak] · 85339386
      qrczak authored
      Added eqString_RDR to implicitFVs.
      85339386
    • simonpj's avatar
      [project @ 2000-10-03 08:43:00 by simonpj] · 710e2074
      simonpj authored
      --------------------------------------
      	Adding generics		SLPJ Oct 2000
      	--------------------------------------
      
      This big commit adds Hinze/PJ-style generic class definitions, based
      on work by Andrei Serjantov.  For example:
      
        class Bin a where
          toBin   :: a -> [Int]
          fromBin :: [Int] -> (a, [Int])
      
          toBin {| Unit |}    Unit	  = []
          toBin {| a :+: b |} (Inl x)   = 0 : toBin x
          toBin {| a :+: b |} (Inr y)   = 1 : toBin y
          toBin {| a :*: b |} (x :*: y) = toBin x ++ toBin y
      
      
          fromBin {| Unit |}    bs      = (Unit, bs)
          fromBin {| a :+: b |} (0:bs)  = (Inl x, bs')    where (x,bs') = fromBin bs
          fromBin {| a :+: b |} (1:bs)  = (Inr y, bs')    where (y,bs') = fromBin bs
          fromBin {| a :*: b |} bs  	  = (x :*: y, bs'') where (x,bs' ) = fromBin bs
      							  (y,bs'') = fromBin bs'
      
      Now we can say simply
      
        instance Bin a => Bin [a]
      
      and the compiler will derive the appropriate code automatically.
      
      		(About 9k lines of diffs.  Ha!)
      
      
      Generic related things
      ~~~~~~~~~~~~~~~~~~~~~~
      
      * basicTypes/BasicTypes: The EP type (embedding-projection pairs)
      
      * types/TyCon:
      	An extra field in an algebraic tycon (genInfo)
      
      * types/Class, and hsSyn/HsBinds:
      	Each class op (or ClassOpSig) carries information about whether
      	it  	a) has no default method
      		b) has a polymorphic default method
      		c) has a generic default method
      	There's a new data type for this: Class.DefMeth
      
      * types/Generics:
      	A new module containing good chunk of the generic-related code
      	It has a .hi-boot file (alas).
      
      * typecheck/TcInstDcls, typecheck/TcClassDcl:
      	Most of the rest of the generics-related code
      
      * hsSyn/HsTypes:
      	New infix type form to allow types of the form
      		data a :+: b = Inl a | Inr b
      
      * parser/Parser.y, Lex.lhs, rename/ParseIface.y:
      	Deal with the new syntax
      
      * prelude/TysPrim, TysWiredIn:
      	Need to generate generic stuff for the wired-in TyCons
      
      * rename/RnSource RnBinds:
      	A rather gruesome hack to deal with scoping of type variables
      	from a generic patterns.  Details commented in the ClassDecl
      	case of RnSource.rnDecl.
      
      	Of course, there are many minor renamer consequences of the
      	other changes above.
      
      * lib/std/PrelBase.lhs
      	Data type declarations for Unit, :+:, :*:
      
      
      Slightly unrelated housekeeping
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      * hsSyn/HsDecls:
      	ClassDecls now carry the Names for their implied declarations
      	(superclass selectors, tycon, etc) in a list, rather than
      	laid out one by one.  This simplifies code between the parser
      	and the type checker.
      
      * prelude/PrelNames, TysWiredIn:
      	All the RdrNames are now together in PrelNames.
      
      * utils/ListSetOps:
      	Add finite mappings based on equality and association lists (Assoc a b)
      	Move stuff from List.lhs that is related
      710e2074
  12. 28 Sep, 2000 1 commit
    • simonpj's avatar
      [project @ 2000-09-28 13:04:14 by simonpj] · 861e836e
      simonpj 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
  13. 25 Sep, 2000 1 commit