1. 25 Apr, 2015 1 commit
  2. 19 Jan, 2015 1 commit
    • Eric Seidel's avatar
      Expose source locations via Implicit Parameters of type GHC.Location.Location · c024af13
      Eric Seidel authored
      Summary:
      IPs with this type will always be solved for the current source
      location. If another IP of the same type is in scope, the two locations will be
      appended, creating a call-stack. The Location type is kept abstract so users
      cannot create them, but a Location can be turned into a list of SrcLocs, which
      correspond to individual locations in a program. Each SrcLoc contains a
      package/module/file name and start/end lines and columns.
      
      The only thing missing from the SrcLoc in my opinion is the name of the
      top-level definition it inhabits. I suspect that would also be useful, but it's
      not clear to me how to extract the current top-level binder from within the
      constraint solver. (Surely I'm just missing something here?)
      
      I made the (perhaps controversial) decision to have GHC completely ignore
      the names of Location IPs, meaning that in the following code:
      
          bar :: (?myloc :: Location) => String
          bar = foo
      
          foo :: (?loc :: Location) => String
          foo = show ?loc
      
      if I call `bar`, the resulting call-stack will include locations for
      
      1. the use of `?loc` inside `foo`,
      2. `foo`s call-site inside `bar`, and
      3. `bar`s call-site, wherever that may be.
      
      This makes Location IPs very special indeed, and I'm happy to change it if the
      dissonance is too great.
      
      I've also left out any changes to base to make use of Location IPs, since there
      were some concerns about a snowball effect. I think it would be reasonable to
      mark this as an experimental feature for now (it is!), and defer using it in
      base until we have more experience with it. It is, after all, quite easy to
      define your own version of `error`, `undefined`, etc. that use Location IPs.
      
      Test Plan: validate, new test-case is testsuite/tests/typecheck/should_run/IPLocation.hs
      
      Reviewers: austin, hvr, simonpj
      
      Reviewed By: simonpj
      
      Subscribers: simonmar, rodlogic, carter, thomie
      
      Differential Revision: https://phabricator.haskell.org/D578
      
      GHC Trac Issues: #9049
      c024af13
  3. 16 Dec, 2014 1 commit
  4. 21 Nov, 2014 1 commit
  5. 24 Sep, 2014 1 commit
  6. 18 Sep, 2014 1 commit
  7. 15 Sep, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Export `Traversable()` and `Foldable()` from Prelude · c0fa383d
      Herbert Valerio Riedel authored
      This exposes *only* the type-classes w/o any of their methods.
      This is the very first step for implementing BPP (see #9586), which
      already requires breaking up several import-cycles leading back to `Prelude`.
      
      Ideally, importing `Prelude` should be avoided in most `base` modules,
      as `Prelude` does not define any entities, but rather re-exports
      existing ones.
      
      Test Plan: validate passes
      
      Reviewers: ekmett, austin
      
      Reviewed By: ekmett, austin
      
      Subscribers: simonmar, ezyang, carter
      
      Differential Revision: https://phabricator.haskell.org/D209
      
      GHC Trac Issues: #9586
      c0fa383d
  8. 28 Sep, 2013 1 commit
  9. 22 Sep, 2013 1 commit
  10. 21 Sep, 2013 1 commit
    • Herbert Valerio Riedel's avatar
      Add Haddock `/Since: 4.7.0.0/` comments to new symbols · 77f32dad
      Herbert Valerio Riedel authored
      These annotations were added in such a way, that the line
      
      {{{
      /Since: 4.7.0.0/
      }}}
      
      represents the last paragraph of the Haddock comment.
      
      Maybe Haddock will have support for this meta-syntax at some point, and
      be able to inherited the since-version property to the children of an
      annotated symbol and display the since-version property in the rendered
      documentation only in cases when it's not visually obvious (for
      instance, when re-exporting documentation strings).
      Signed-off-by: Herbert Valerio Riedel's avatarHerbert Valerio Riedel <hvr@gnu.org>
      77f32dad
  11. 21 Aug, 2012 1 commit
    • Simon Marlow's avatar
      add errorWithStackTrace · 889ff4aa
      Simon Marlow authored
      -- | Like the function 'error', but appends a stack trace to the error
      -- message if one is available.
      errorWithStackTrace :: String -> a
      889ff4aa
  12. 06 Dec, 2011 1 commit
  13. 02 Dec, 2011 1 commit
  14. 01 Dec, 2011 1 commit
  15. 30 Nov, 2011 2 commits
  16. 29 Nov, 2011 1 commit
    • Simon Marlow's avatar
      Add a way to get hold of the current call stack · 135680b7
      Simon Marlow authored
        GHC.Stack.currentCallStack :: IO [String]
      
      At the moment this uses the profiler's cost-centre stack; maybe in the
      future it might use some other mechanism.  Right now it only gives
      useful results when profiling and using -fprof-auto or similar, but it
      could be quite handy. e.g.
      
      f :: Int -> IO Int
      f x = do currentCallStack >>= print; return (x+1)
      
      mapM :: Monad m => (a -> m b) -> [a] -> m [b]
      mapM f xs = go xs
        where go []     = return []
              go (x:xs) = do
                x' <- f x
                xs' <- mapM f xs
                return (x':xs')
      
      main = mapM f [42,42]
      
      $ ./stack
      ["MAIN.MAIN","Main.main","Main.mapM","Main.mapM.go","Main.f"]
      ["MAIN.MAIN","Main.main","Main.mapM","Main.mapM.go","Main.f"]
      135680b7