1. 08 Oct, 2019 15 commits
  2. 07 Oct, 2019 1 commit
  3. 05 Oct, 2019 1 commit
  4. 03 Oct, 2019 2 commits
  5. 28 Sep, 2019 2 commits
    • Ron Mordechai's avatar
      Allow users to disable Unicode with an env var · 9c02a793
      Ron Mordechai authored
      Unicode renders funny on my terminal and I like to avoid it where
      possible. Most applications which print out non-ascii characters allow
      users to disable such prints with an environment variable (e.g.
      Homebrew).
      
      This diff disables Unicode usage when the environment variable
      `GHC_NO_UNICODE` is set. To test, set the env var and compile a bad
      program. Note that GHC does not print Unicode bullets but instead prints
      out asterisks:
      
      ```
      $ GHC_NO_UNICODE= _build/stage1/bin/ghc ../Temp.hs
      [1 of 1] Compiling Temp             ( ../Temp.hs, ../Temp.o )
      
      ../Temp.hs:4:23: error:
          * Couldn't match type `Bool' with `a -> Bool'
            Expected type: Bool -> a -> Bool
              Actual type: Bool -> Bool
          * In the first argument of `foldl', namely `(&& (flip $ elem u))'
            In the expression: foldl (&& (flip $ elem u)) True v
            In an equation for `isPermut':
                isPermut u v = foldl (&& (flip $ elem u)) True v
          * Relevant bindings include
              v :: [a] (bound at ../Temp.hs:4:12)
              u :: [a] (bound at ../Temp.hs:4:10)
              isPermut :: [a] -> [a] -> Bool (bound at ../Temp.hs:4:1)
        |
      4 | isPermut u v = foldl (&& (flip $ elem u)) True v
        |                       ^^^^^^^^^^^^^^^^^^
      ```
      
      (Broken code taken from Stack Overflow)
      9c02a793
    • Sebastian Graf's avatar
  6. 26 Sep, 2019 1 commit
    • Ryan Scott's avatar
      Make -fbyte-code prevent unboxed tuples/sums from implying object code (#16876) · 4f81fab0
      Ryan Scott authored
      This resolves #16876 by making the explicit use of `-fbyte-code`
      prevent code that enables `UnboxedTuples` or `UnboxedSums` from
      automatically compiling to object code. This allows for a nice
      middle ground where most code that enables `UnboxedTuples`/-`Sums`
      will still benefit from automatically enabling `-fobject-code`, but
      allows power users who wish to avoid this behavior in certain corner
      cases (such as `lens`, whose use case is documented in #16876) to do
      so.
      
      Along the way, I did a little cleanup of the relevant code and
      documentation:
      
      * `enableCodeGenForUnboxedTuples` was only checking for the presence
        of `UnboxedTuples`, but `UnboxedSums` has the same complications.
        I fixed this and renamed the function to
        `enableCodeGenForUnboxedTuplesOrSums`.
      * I amended the users' guide with a discussion of these issues.
      4f81fab0
  7. 25 Sep, 2019 3 commits
    • Vladislav Zavialov's avatar
      Standalone kind signatures (#16794) · 0b5eede9
      Vladislav Zavialov authored
      Implements GHC Proposal #54: .../ghc-proposals/blob/master/proposals/0054-kind-signatures.rst
      
      With this patch, a type constructor can now be given an explicit
      standalone kind signature:
      
        {-# LANGUAGE StandaloneKindSignatures #-}
        type Functor :: (Type -> Type) -> Constraint
        class Functor f where
          fmap :: (a -> b) -> f a -> f b
      
      This is a replacement for CUSKs (complete user-specified
      kind signatures), which are now scheduled for deprecation.
      
      User-facing changes
      -------------------
      
      * A new extension flag has been added, -XStandaloneKindSignatures, which
        implies -XNoCUSKs.
      
      * There is a new syntactic construct, a standalone kind signature:
      
          type <name> :: <kind>
      
        Declarations of data types, classes, data families, type families, and
        type synonyms may be accompanied by a standalone kind signature.
      
      * A standalone kind signature enables polymorphic recursion in types,
        just like a function type signature enables polymorphic recursion in
        terms. This obviates the need for CUSKs.
      
      * TemplateHaskell AST has been extended with 'KiSigD' to represent
        standalone kind signatures.
      
      * GHCi :info command now prints the kind signature of type constructors:
      
          ghci> :info Functor
          type Functor :: (Type -> Type) -> Constraint
          ...
      
      Limitations
      -----------
      
      * 'forall'-bound type variables of a standalone kind signature do not
        scope over the declaration body, even if the -XScopedTypeVariables is
        enabled. See #16635 and #16734.
      
      * Wildcards are not allowed in standalone kind signatures, as partial
        signatures do not allow for polymorphic recursion.
      
      * Associated types may not be given an explicit standalone kind
        signature. Instead, they are assumed to have a CUSK if the parent class
        has a standalone kind signature and regardless of the -XCUSKs flag.
      
      * Standalone kind signatures do not support multiple names at the moment:
      
          type T1, T2 :: Type -> Type   -- rejected
          type T1 = Maybe
          type T2 = Either String
      
        See #16754.
      
      * Creative use of equality constraints in standalone kind signatures may
        lead to GHC panics:
      
          type C :: forall (a :: Type) -> a ~ Int => Constraint
          class C a where
            f :: C a => a -> Int
      
        See #16758.
      
      Implementation notes
      --------------------
      
      * The heart of this patch is the 'kcDeclHeader' function, which is used to
        kind-check a declaration header against its standalone kind signature.
        It does so in two rounds:
      
          1. check user-written binders
          2. instantiate invisible binders a la 'checkExpectedKind'
      
      * 'kcTyClGroup' now partitions declarations into declarations with a
        standalone kind signature or a CUSK (kinded_decls) and declarations
        without either (kindless_decls):
      
          * 'kinded_decls' are kind-checked with 'checkInitialKinds'
          * 'kindless_decls' are kind-checked with 'getInitialKinds'
      
      * DerivInfo has been extended with a new field:
      
          di_scoped_tvs :: ![(Name,TyVar)]
      
        These variables must be added to the context in case the deriving clause
        references tcTyConScopedTyVars. See #16731.
      0b5eede9
    • Sebastian Graf's avatar
      PmCheck: Only ever check constantly many models against a single pattern · ebc65025
      Sebastian Graf authored
      Introduces a new flag `-fmax-pmcheck-deltas` to achieve that. Deprecates
      the old `-fmax-pmcheck-iter` mechanism in favor of this new flag.
      
      From the user's guide:
      
      Pattern match checking can be exponential in some cases. This limit makes sure
      we scale polynomially in the number of patterns, by forgetting refined
      information gained from a partially successful match. For example, when
      matching `x` against `Just 4`, we split each incoming matching model into two
      sub-models: One where `x` is not `Nothing` and one where `x` is `Just y` but
      `y` is not `4`. When the number of incoming models exceeds the limit, we
      continue checking the next clause with the original, unrefined model.
      
      This also retires the incredibly hard to understand "maximum number of
      refinements" mechanism, because the current mechanism is more general
      and should catch the same exponential cases like PrelRules at the same
      time.
      
      -------------------------
      Metric Decrease:
          T11822
      -------------------------
      ebc65025
    • Kari Pahula's avatar
      Add -Wderiving-defaults (#15839) · 2970dc7a
      Kari Pahula authored
      Enabling both DeriveAnyClass and GeneralizedNewtypeDeriving can cause
      a warning when no explicit deriving strategy is in use. This change adds
      an enable/suppress flag for it.
      2970dc7a
  8. 23 Sep, 2019 2 commits
  9. 20 Sep, 2019 2 commits
  10. 17 Sep, 2019 1 commit
    • Matthew Pickering's avatar
      eventlog: Add biographical and retainer profiling traces · ae4415b9
      Matthew Pickering authored
      This patch adds a new eventlog event which indicates the start of
      a biographical profiler sample. These are different to normal events as
      they also include the timestamp of when the census took place. This is
      because the LDV profiler only emits samples at the end of the run.
      
      Now all the different profiling modes emit consumable events to the
      eventlog.
      ae4415b9
  11. 16 Sep, 2019 1 commit
    • Sebastian Graf's avatar
      Encode shape information in `PmOracle` · 7915afc6
      Sebastian Graf authored
      Previously, we had an elaborate mechanism for selecting the warnings to
      generate in the presence of different `COMPLETE` matching groups that,
      albeit finely-tuned, produced wrong results from an end user's
      perspective in some cases (#13363).
      
      The underlying issue is that at the point where the `ConVar` case has to
      commit to a particular `COMPLETE` group, there's not enough information
      to do so and the status quo was to just enumerate all possible complete
      sets nondeterministically.  The `getResult` function would then pick the
      outcome according to metrics defined in accordance to the user's guide.
      But crucially, it lacked knowledge about the order in which affected
      clauses appear, leading to the surprising behavior in #13363.
      
      In !1010 we taught the term oracle to reason about literal values a
      variable can certainly not take on. This MR extends that idea to
      `ConLike`s and thereby fixes #13363: Instead of committing to a
      particular `COMPLETE` group in the `ConVar` case, we now split off the
      matching constructor incrementally and record the newly covered case as
      a refutable shape in the oracle. Whenever the set of refutable shapes
      covers any `COMPLETE` set, the oracle recognises vacuosity of the
      uncovered set.
      
      This patch goes a step further: Since at this point the information
      in value abstractions is merely a cut down representation of what the
      oracle knows, value abstractions degenerate to a single `Id`, the
      semantics of which is determined by the oracle state `Delta`.
      Value vectors become lists of `[Id]` given meaning to by a single
      `Delta`, value set abstractions (of which the uncovered set is an
      instance) correspond to a union of `Delta`s which instantiate the
      same `[Id]` (akin to models of formula).
      
      Fixes #11528 #13021, #13363, #13965, #14059, #14253, #14851, #15753, #17096, #17149
      
      -------------------------
      Metric Decrease:
          ManyAlternatives
          T11195
      -------------------------
      7915afc6
  12. 14 Sep, 2019 1 commit
  13. 12 Sep, 2019 1 commit
    • Ningning Xie's avatar
      Fix StandaloneDeriving · 86753475
      Ningning Xie authored
      If I understand correctly, `deriving instance _ => Eq (Foo a)`
      is equivalent to `data Foo a deriving Eq`, rather than
      `data Foo a deriving Foo`.
      86753475
  14. 09 Sep, 2019 2 commits
  15. 29 Aug, 2019 1 commit
  16. 07 Aug, 2019 3 commits
    • mniip's avatar
      Fix documentation · ca8efc49
      mniip authored
      ca8efc49
    • mniip's avatar
    • mniip's avatar
      Add a -fprint-axiom-incomps option (#15546) · 2073745c
      mniip authored
      Supply branch incomps when building an IfaceClosedSynFamilyTyCon
      
      `pprTyThing` now has access to incomps. This also causes them to be
      written out to .hi files, but that doesn't pose an issue other than a
      more faithful bijection between `tyThingToIfaceDecl` and `tcIfaceDecl`.
      
      The machinery for displaying axiom incomps was already present but not
      in use. Since this is now a thing that pops up in ghci's :info the
      format was modified to look like a haskell comment.
      
      Documentation and a test for the new feature included.
      
      Test Plan: T15546
      
      Reviewers: simonpj, bgamari, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15546
      
      Differential Revision: https://phabricator.haskell.org/D5097
      2073745c
  17. 02 Aug, 2019 1 commit