Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Oct 1, 2011
  1. @igfoo

    Handle newtypes and type functions correctly in FFI types; fixes #3008

    igfoo authored
    You can now use type functions in FFI types.
    Newtypes are now only looked through if the constructor is in scope.
Commits on Sep 29, 2011
  1. @simonpj

    Fix parenthesisation in conversion from TH.Exp to HsExpr.HsExpr

    simonpj authored
    We need to generate enough parens so that -ddump-splices is
    correct Haskell.  There is certainly further to go.
  2. @simonpj

    Fix scoping for RHS of associated type decls (fixes Trac #5515)

    simonpj authored
    We should not allow things like
    class C a b where
      type F a :: *
    instance C (p,q) r where
      type F (p,q) = r   -- No! fvs(rhs) should be a subset
                         --     of fvs(lhs)
Commits on Sep 17, 2011
  1. @igfoo
  2. @igfoo
Commits on Sep 9, 2011
  1. @batterseapower

    Merge branch 'no-pred-ty'

    batterseapower authored
  2. @batterseapower

    Implement associated type defaults

    batterseapower authored
    Basically, now you can write:
      class Cls a where
        type Typ a
        type Typ a = Just a
    And now if an instance does not specify an explicit associated type
    instance, one will be generated afresh based on that default. So for
    example this instance:
      instance Cls Int where
    Will be equivalent to this one:
      instance Cls Int where
        type Typ Int = Just Int
Commits on Sep 6, 2011
  1. @batterseapower

    Implement -XConstraintKind

    batterseapower authored
    Basically as documented in,
    this patch adds a new kind Constraint such that:
      Show :: * -> Constraint
      (?x::Int) :: Constraint
      (Int ~ a) :: Constraint
    And you can write *any* type with kind Constraint to the left of (=>):
    even if that type is a type synonym, type variable, indexed type or so on.
    The following (somewhat related) changes are also made:
     1. We now box equality evidence. This is required because we want
        to give (Int ~ a) the *lifted* kind Constraint
     2. For similar reasons, implicit parameters can now only be of
        a lifted kind. (?x::Int#) => ty is now ruled out
     3. Implicit parameter constraints are now allowed in superclasses
        and instance contexts (this just falls out as OK with the new
        constraint solver)
    Internally the following major changes were made:
     1. There is now no PredTy in the Type data type. Instead
        GHC checks the kind of a type to figure out if it is a predicate
     2. There is now no AClass TyThing: we represent classes as TyThings
        just as a ATyCon (classes had TyCons anyway)
     3. What used to be (~) is now pretty-printed as (~#). The box
        constructor EqBox :: (a ~# b) -> (a ~ b)
     4. The type LCoercion is used internally in the constraint solver
        and type checker to represent coercions with free variables
        of type (a ~ b) rather than (a ~# b)
Commits on Sep 2, 2011
  1. @simonpj

    Make Convert.thRdrName give a decent source locations (fixes Trac #5434)

    simonpj authored
    thRdrName is used to construct *binders*, and some of them are
    Exact RdrNames, so we need to give them a decent source location.
Commits on Sep 1, 2011
  1. @simonpj

    Fix the trimming of bind_fvs (fixes Trac #5439)

    simonpj authored
    For the bind_fvs field of FunBind/PatBind, we need to be careful to
    keep track of uses of all functions in this module (although not
    imported ones).  Moreover in TcBinds.decideGeneralisationPlan we
    need to take note of uses of lexically scoped type variables.
    These two buglets led to a (useful) assertion failure in TcEnv.
  2. @simonpj

    Allow associated types to have fresh parameters

    simonpj authored
    This patch allows
         class C a where
           type T a b :: *
         instance C Int
           type T Int b = b -> b
    That is, T has a type index 'b' that is not one of the class
    On the way I did a good deal of refactoring (as usual), especially in
    TcInstDcls.tcLocalInstDecl1, which checks for consistent instantiation
    of the class instance and the type instance.  Less code, more
    expressiveness.  See Note [Checking consistent instantiation]
Commits on Aug 26, 2011
  1. @simonmar

    Clean up the handling of the import and :module commands in GHCi

    simonmar authored
    Previously we remembered the whole history of commands and replayed
    them on every :load/:reload, which lead to some non-linear performance
    characteristics (#5317).  The handling of the implicit Prelude import
    and the implicit imports of recently loaded modules was also
    complicated and wrong in various obscure ways.
    The Prelude import works just like the implicit Prelude import in a
    Haskell module: it can be overriden with an explicit Prelude
    I have added a new ":show imports" command to show which imports are
    currently in force.
    Prelude> :show imports
    import Prelude -- implicit
    Prelude> import Prelude ()
    Prelude> :show imports
    import Prelude ()
    Prelude> map
    <interactive>:0:1: Not in scope: `map'
    Full documentation in the User's Guide.
    There are various other little tweaks and improvements, such as when a
    module is imported with 'as', we now show the 'as' name in the prompt
    rather than the original name.
  2. @simonmar
Commits on Aug 24, 2011
  1. @mchakravarty

    Functions and types can now be post-hoc vectorised; i.e., in modules …

    mchakravarty authored
    …where they are not declared, but only imported
    - Types already gained this functionality already in a previous commit
    - This commit adds the capability for functions
    This is a crucial step towards being able to use the standard Prelude, instead of a special vectorised one.
Commits on Aug 23, 2011
  1. @simonpj

    Minor wibbles to pretty-printing HsSyn

    simonpj authored
    Mainly affecting how declarations are printed
    Ie by default: laid out with no braces
Commits on Aug 22, 2011
  1. @simonpj

    A batch of changes related to the handling of binders in instance decls

    simonpj authored
    The issue is that in
        instnace C T where
          data S = ...
          f = ...
    neither S nor f is really a binder; they are *occurrences*.  Moreover
    Haskell dictates that these particular occurrences are disambiguated
    by looking at the class whose instance they occur in.
    Some of this was not handled right for associated types.  And
    RnNames.getLocalNonValBinders was a bit messhy; this patch tidies it
    (And thenM is finally gone from RnSource.)
  2. @simonpj
Commits on Aug 18, 2011
  1. @mchakravarty
  2. @mchakravarty

    Add VECTORISE [SCALAR] type pragma

    mchakravarty authored
    - Pragma to determine how a given type is vectorised
    - At this stage only the VECTORISE SCALAR variant is used by the vectoriser.
    - '{-# VECTORISE SCALAR type t #-}' implies that 't' cannot contain parallel arrays and may be used in vectorised code.  However, its constructors can only be used in scalar code.  We use this, e.g., for 'Int'.
    - May be used on imported types
    See also
Commits on Aug 16, 2011
  1. @simonpj

    Major improvement to pattern bindings

    simonpj authored
    This patch makes a number of related improvements
    a) Implements the Haskell Prime semantics for pattern bindings
       (Trac #2357).  That is, a pattern binding p = e is typed
       just as if it had been written
            t = e
            f = case t of p -> f
            g = case t of p -> g
            ... etc ...
       where f,g are the variables bound by p. In paricular it's
       ok to say
          (f,g) = (\x -> x, \y -> True)
       and f and g will get propertly inferred types
          f :: a -> a
          g :: a -> Int
    b) Eliminates the MonoPatBinds flag altogether.  (For the moment
       it is deprecated and has no effect.)  Pattern bindings are now
       generalised as per (a).  Fixes Trac #2187 and #4940, in the
       way the users wanted!
    c) Improves the OutsideIn algorithm generalisation decision.
       Given a definition without a type signature (implying "infer
       the type"), the published algorithm rule is this:
          - generalise *top-level* functions, and
          - do not generalise *nested* functions
       The new rule is
          - generalise a binding whose free variables have
            Guaranteed Closed Types
          - do not generalise other bindings
       Generally, a top-level let-bound function has a Guaranteed
       Closed Type, and so does a nested function whose free vaiables
       are top-level functions, and so on. (However a top-level
       function that is bitten by the Monomorphism Restriction does
       not have a GCT.)
         f x = let { foo y = y } in ...
       Here 'foo' has no free variables, so it is generalised despite
       being nested.
    d) When inferring a type f :: ty for a definition f = e, check that
       the compiler would accept f :: ty as a type signature for that
       same definition.  The type is rejected precisely when the type
       is ambiguous.
          class Wob a b where
            to :: a -> b
            from :: b -> a
          foo x = [x, to (from x)]
       GHC 7.0 would infer the ambiguous type
          foo :: forall a b. Wob a b => b -> [b]
       but that type would give an error whenever it is called; and
       GHC 7.0 would reject that signature if given by the
       programmer.  The new type checker rejects it up front.
       Similarly, with the advent of type families, ambiguous types are
       easy to write by mistake.  See Trac #1897 and linked tickets for
       many examples.  Eg
          type family F a :: *
          f ::: F a -> Int
          f x = 3
       This is rejected because (F a ~ F b) does not imply a~b.  Previously
       GHC would *infer* the above type for f, but was unable to check it.
       Now even the inferred type is rejected -- correctly.
    The main implemenation mechanism is to generalise the abe_wrap
    field of ABExport (in HsBinds), from [TyVar] to HsWrapper. This
    beautiful generalisation turned out to make everything work nicely
    with minimal programming effort.  All the work was fiddling around
    the edges; the core change was easy!
Commits on Aug 15, 2011
  1. @simonpj

    Fix Trac #5404: looking up signature binders in RnEnv

    simonpj authored
    See Note [Looking up Exact RdrNames] in RnEnv
Commits on Aug 5, 2011
  1. @simonpj

    Another run at binders in Template Haskell (fixes Trac #5379)

    simonpj authored
    TH quotation was using mkName rather than newName for
    top-level definitions, which is plain wrong as #5379
    points out.
  2. @simonpj

    Fix a long-standing bug in HsUtils.hsTyClDeclBinders

    simonpj authored
    We were returning the tycon of a type family *instance*
    as a binder, and it just isn't!
    Consequential tidy-ups follow.  I tripped over this on
    the way to something else.  I'm not sure it was causing
    a problem, but it is Plainly Wrong.
Commits on Aug 3, 2011
  1. @simonpj

    Replace use of 'asTypeOf' by type signatures

    simonpj authored
    The type signatures are much clearer, but need ScopedTypeVariables.
    Happily that is now available in our bootstrap compilers.
Commits on Aug 2, 2011
  1. @simonpj

    Refactor the imports of InteractiveContext

    simonpj authored
    Instead of two fields
       ic_toplev_scope :: [Module]
       ic_imports      :: [ImportDecl RdrName]
    we now just have one
       ic_imports :: [InteractiveImport]
    with the auxiliary data type
       data InteractiveImport
        = IIDecl (ImportDecl RdrName)  -- Bring the exports of a particular module
        	   	       		   -- (filtered by an import decl) into scope
        | IIModule Module	-- Bring into scope the entire top-level envt of
        	     		-- of this module, including the things imported
    			-- into it.
    This makes lots of code less confusing.  No change in behaviour.
    It's preparatory to fixing Trac #5147.
    While I was at I also
      * Cleaned up the handling of the "implicit" Prelude import
        by adding a ideclImplicit field to ImportDecl.  This
        significantly reduces plumbing in the handling of
        the implicit Prelude import
      * Used record notation consistently for ImportDecl
Commits on Jul 27, 2011
  1. @simonpj
  2. @simonpj

    A bit of refactoring on handling HsPar and friends

    simonpj authored
    This relates to Trac #4430 (infix expressions in TH),.
    Mainly comments but a bit of code wibbling.
Commits on Jul 25, 2011
  1. @reinerp @simonpj

    Add support for unresolved infix expressions and patterns

    reinerp authored simonpj committed
Commits on Jul 21, 2011
  1. @simonpj
Commits on Jul 20, 2011
  1. @simonpj

    Comments only

    simonpj authored
  2. @simonpj

    Fix #5332 (more): unboxed singleton tuples are fine

    simonpj authored
    This patch fixes the unboxed singleton tuples in types and patterns
Commits on Jul 19, 2011
  1. @igfoo
Commits on Jul 18, 2011
  1. @simonpj
Commits on Jul 15, 2011
  1. @simonpj

    Extend Template Haskell to support the UNPACk pragma on data construc…

    simonpj authored
    (Work done by mikhail.vorozhtsov.)
  2. @simonpj
Something went wrong with that request. Please try again.