Skip to content
Snippets Groups Projects
  1. Feb 17, 2014
  2. Jan 20, 2014
    • Gergő Érdi's avatar
      Implement pattern synonyms · 4f8369bf
      Gergő Érdi authored
      This patch implements Pattern Synonyms (enabled by -XPatternSynonyms),
      allowing y ou to assign names to a pattern and abstract over it.
      
      The rundown is this:
      
        * Named patterns are introduced by the new 'pattern' keyword, and can
          be either *unidirectional* or *bidirectional*. A unidirectional
          pattern is, in the simplest sense, simply an 'alias' for a pattern,
          where the LHS may mention variables to occur in the RHS. A
          bidirectional pattern synonym occurs when a pattern may also be used
          in expression context.
      
        * Unidirectional patterns are declared like thus:
      
              pattern P x <- x:_
      
          The synonym 'P' may only occur in a pattern context:
      
              foo :: [Int] -> Maybe Int
              foo (P x) = Just x
              foo _     = Nothing
      
        * Bidirectional patterns are declared like thus:
      
              pattern P x y = [x, y]
      
          Here, P may not only occur as a pattern, but also as an expression
          when given values for 'x' and 'y', i.e.
      
              bar :: Int -> [Int]
              bar x = P x 10
      
        * Patterns can't yet have their own type signatures; signatures are inferred.
      
        * Pattern synonyms may not be recursive, c.f. type synonyms.
      
        * Pattern synonyms are also exported/imported using the 'pattern'
          keyword in an import/export decl, i.e.
      
              module Foo (pattern Bar) where ...
      
          Note that pattern synonyms share the namespace of constructors, so
          this disambiguation is required as a there may also be a 'Bar'
          type in scope as well as the 'Bar' pattern.
      
        * The semantics of a pattern synonym differ slightly from a typical
          pattern: when using a synonym, the pattern itself is matched,
          followed by all the arguments. This means that the strictness
          differs slightly:
      
              pattern P x y <- [x, y]
      
              f (P True True) = True
              f _             = False
      
              g [True, True] = True
              g _            = False
      
          In the example, while `g (False:undefined)` evaluates to False,
          `f (False:undefined)` results in undefined as both `x` and `y`
          arguments are matched to `True`.
      
      For more information, see the wiki:
      
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms
          https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms/Implementation
      
      
      
      Reviewed-by: default avatarSimon Peyton Jones <simonpj@microsoft.com>
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      4f8369bf
  3. Jan 14, 2014
  4. Jan 07, 2014
    • John Lenz's avatar
      runghc: Fix interaction of stdin and --ghc-args · ec4af3fb
      John Lenz authored
      
      When reading the program from standard input, runghc did not properly
      handle the --ghc-arg= escape for arguments to ghc which do not start
      with a dash, since arguments were processed twice and the first time the
      --ghc-arg= was stripped.  Now arguments are only processed once.  For
      backwards compatibility, a prefix of --ghc-arg=--ghc-arg= is allowed
      since this prefix will work on both old and new versions of ghc.
      
      This fixes #8601
      
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      ec4af3fb
  5. Nov 28, 2013
  6. Nov 15, 2013
  7. Oct 27, 2013
  8. Oct 26, 2013
  9. Oct 25, 2013
  10. Oct 17, 2013
  11. Oct 12, 2013
    • Darin Morrison's avatar
      Fix mkdirhier.sh on OS X 10.9 (#8139) · feb76385
      Darin Morrison authored
      
      Mac OS X 10.9 mkdir is apparently stricter than the Mac OS X 10.8
      mkdir about which paths are considered valid arguments. For example,
      in a typical build on Mac OS X 10.9, the first of the following
      invocations of mkdirhier.sh will succeed but the second will fail:
      
      "inplace/bin/mkdirhier"   utils/ghc-cabal/dist/build/tmp//.  # WORKS
      "inplace/bin/mkdirhier"   bootstrapping/.                    # FAILS
      
      Simply prefixing the path arguments with "./" causes both to succeed:
      
      "inplace/bin/mkdirhier" ./utils/ghc-cabal/dist/build/tmp//.  # WORKS
      "inplace/bin/mkdirhier" ./bootstrapping/.                    # WORKS
      
      Testing indicates failure on paths satisfying all of these criteria:
      
      - path is suffixed with "/."
      - path is only 1 level deep (e.g., "foo/."; _not_ "foo/bar/.")
      - path is _not_ prefixed with "./"
      
      This workaround prefixes "./" to the path argument passed to mkdir.
      
      Signed-off-by: default avatarAustin Seipp <austin@well-typed.com>
      feb76385
  12. Oct 11, 2013
  13. Oct 02, 2013
  14. Oct 01, 2013
  15. Sep 23, 2013
  16. Sep 18, 2013
    • Richard Eisenberg's avatar
      Change role annotation syntax. · f4046b50
      Richard Eisenberg authored
      This fixes bugs #8185, #8234, and #8246. The new syntax is explained
      in the comments to #8185, appears in the "Roles" subsection of the
      manual, and on the [wiki:Roles] wiki page.
      
      This change also removes the ability for a role annotation on type
      synonyms, as noted in #8234.
      f4046b50
  17. Sep 15, 2013
  18. Sep 13, 2013
  19. Sep 11, 2013
  20. Sep 07, 2013
  21. Sep 04, 2013
  22. Aug 26, 2013
  23. Aug 23, 2013
  24. Aug 22, 2013
  25. Aug 14, 2013
    • Jan Stolarek's avatar
      Comparison primops return Int# (Fixes #6135) · 6579a6c7
      Jan Stolarek authored
      This patch modifies all comparison primops for Char#, Int#, Word#, Double#,
      Float# and Addr# to return Int# instead of Bool. A value of 1# represents True
      and 0# represents False. For a more detailed description of motivation for this
      change, discussion of implementation details and benchmarking results please
      visit the wiki page: http://hackage.haskell.org/trac/ghc/wiki/PrimBool
      
      There's also some cleanup: whitespace fixes in files that were extensively edited
      in this patch and constant folding rules for Integer div and mod operators (which
      for some reason have been left out up till now).
      6579a6c7
  26. Aug 06, 2013
  27. Jun 24, 2013
  28. Jun 15, 2013
    • takano-akio's avatar
      fe652a8b
    • takano-akio's avatar
      Allow multiple C finalizers to be attached to a Weak# · d61c623e
      takano-akio authored
      The commit replaces mkWeakForeignEnv# with addCFinalizerToWeak#.
      This new primop mutates an existing Weak# object and adds a new
      C finalizer to it.
      
      This change removes an invariant in MarkWeak.c, namely that the relative
      order of Weak# objects in the list needs to be preserved across GC. This
      makes it easier to split the list into per-generation structures.
      
      The patch also removes a race condition between two threads calling
      finalizeWeak# on the same WEAK object at that same time.
      d61c623e
  29. Jun 13, 2013
  30. May 30, 2013
  31. May 14, 2013
    • Ian Lynagh's avatar
      Fix the GHC package DLL-splitting · 60b86b04
      Ian Lynagh authored
      There's now an internal -dll-split flag, which we use to tell GHC how
      the GHC package is split into 2 separate DLLs. This is used by
      Packages.isDllName to determine whether a call is within the same
      DLL, or whether it is a call to another DLL.
      60b86b04
    • Ian Lynagh's avatar
      Simplify ghc-cabal · ff1a16a0
      Ian Lynagh authored
      It now consistently takes directory and distDirectory as its first 2
      arguments. Also, it only supports configuring 1 package at a time now
      (we weren't using the ability to configure more than one at once).
      ff1a16a0
Loading