| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement hexadecmial floating point literals.
The digits of the mantissa are hexadecimal.
The exponent is written in base 10, and the base for the exponentiation is 2.
Hexadecimal literals look a lot like ordinary decimal literals, except that
they use hexadecmial digits, and the exponent is written using `p` rather than `e`.
The specification of the feature is available here:
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0004-hexFloats.rst
For a discussion of the various choices:
https://github.com/ghc-proposals/ghc-proposals/pull/37
Reviewers: mpickering, goldfire, austin, bgamari, hvr
Reviewed By: bgamari
Subscribers: mpickering, thomie
Differential Revision: https://phabricator.haskell.org/D3066
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces "freezing," an operation which prevents further
locations from being appended to a CallStack. Library authors may want
to prevent CallStacks from exposing implementation details, as a matter
of hygiene. For example, in
```
head [] = error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
including the call-site of `error` in `head` is not strictly necessary
as the error message already specifies clearly where the error came
from.
So we add a function `freezeCallStack` that wraps an existing CallStack,
preventing further call-sites from being pushed onto it. In other words,
```
pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack
```
Now we can define `head` to not produce a CallStack at all
```
head [] =
let ?callStack = freezeCallStack emptyCallStack
in error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
---
1. We add the `freezeCallStack` and `emptyCallStack` and update the
definition of `CallStack` to support this functionality.
2. We add `errorWithoutStackTrace`, a variant of `error` that does not
produce a stack trace, using this feature. I think this is a sensible
wrapper function to provide in case users want it.
3. We replace uses of `error` in base with `errorWithoutStackTrace`. The
rationale is that base does not export any functions that use CallStacks
(except for `error` and `undefined`) so there's no way for the stack
traces (from Implicit CallStacks) to include user-defined functions.
They'll only contain the call to `error` itself. As base already has a
good habit of providing useful error messages that name the triggering
function, the stack trace really just adds noise to the error. (I don't
have a strong opinion on whether we should include this third commit,
but the change was very mechanical so I thought I'd include it anyway in
case there's interest)
4. Updates tests in `array` and `stm` submodules
Test Plan: ./validate, new test is T11049
Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari
Reviewed By: simonpj
Subscribers: thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1628
GHC Trac Issues: #11049
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- This part of the proposal is to add log1p, expm1, log1pexp and
log1mexp to the Floating class, and export the full Floating class
from Numeric
Reviewers: ekmett, #core_libraries_committee, bgamari, hvr, austin
Reviewed By: ekmett, #core_libraries_committee, bgamari
Subscribers: Phyx, RyanGlScott, ekmett, thomie
Differential Revision: https://phabricator.haskell.org/D1605
GHC Trac Issues: #11166
|
|
|
|
|
|
| |
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
|
|
|
|
|
|
|
| |
This is preparatory work for reintroducing SPECIALISEs that were lost
in d94de87252d0fe2ae97341d186b03a2fbe136b04
Differential Revision: https://phabricator.haskell.org/D214
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 <hvr@gnu.org>
|
|
|
|
| |
Signed-off-by: Joachim Breitner <mail@joachim-breitner.de>
|
|
|
|
|
|
|
|
|
|
| |
Now that HUGS and NHC specific code has been removed, this commit "folds"
the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This
renders `base` officially GHC only.
This commit also removes redundant `{-# LANGUAGE CPP #-}`.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
| |
For rationale. see
http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/2349
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These comments are rather less useful now that haddock can give docs
with the same informatino in the module synopsis.
Having to maintain them when making changes to the library is a pain,
and when people forget about doing so there is nothing that checks that
the comments are right, so mistakes tend to linger.
Of the comments that my script detected, 78 of 684 were already
incorrect in one way or another, e.g. missing context:
Text.Show.showsPrec
Comment type: Int -> a -> ShowS
Actual type: Show a => Int -> a -> ShowS
wrong context:
Numeric.readInt
Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
Actual type: Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
not following a class change (e.g. Num losing its Eq superclass):
Text.Read.Lex.readOctP
Comment type: Num a => ReadP a
Actual type: (Eq a, Num a) => ReadP a
not following the Exceptions change:
GHC.Conc.childHandler
Comment type: Exception -> IO ()
Actual type: SomeException -> IO ()
or just always been wrong:
GHC.Stable.deRefStablePtr
Comment type: StablePtr a -> a
Actual type: StablePtr a -> IO a
|
|
|
|
|
| |
This doesn't change the behaviour yet, but I think it's a step in the
right direction.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add explicit {-# LANGUAGE xxx #-} pragmas to each module, that say
what extensions that module uses. This makes it clearer where
different extensions are used in the (large, variagated) base package.
Now base.cabal doesn't need any extensions field
Thanks to Bas van Dijk for doing all the work.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Use OPTIONS_GHC instead of OPTIONS
|
|
|
|
| |
docs only
|
|
|
|
| |
fix a warning
|
|
|
|
|
|
|
|
| |
showIntAtBase:
- implementation uses quotRem [where the remainder isn't always
non-negative -- ditto for divMod, so there's no trivial fix],
negative bases aren't supported; catch this.
- separate argument validity checking from actual digitisation.
|
|
|
|
|
|
|
|
|
|
| |
Fix showIntAtBase to match the report. Its signature was previously
showIntAtBase :: Integral a => a -> (a -> Char) -> a -> ShowS
and is now:
showIntAtBase :: Integral a => a -> (a -> Char) -> a -> ShowS
|
|
|
|
|
|
|
| |
- Make showHex and showOct match the report (don't add leading "Ox" or
"Oo").
- Remove showBin, which isn't specified by the report.
|
|
|
|
| |
(hugs only): PrelImpl -> Hugs.Prelude
|
|
|
|
| |
Hugs updates + fixes
|
|
|
|
|
|
|
| |
Make the libraries' Numeric module usable by Hugs. Also deleted a chunk
of code inside #ifdef __HUGS__ -- this was unused, and the copy in Hugs
(now Hugs.Numeric) has since been improved. (Since these functions are
portable, ideally they would be merged with the versions in GHC.Float)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
------------------------------------------------
Fix the (new) lexer, and make the derived read
and show code work according to the new H98 report
------------------------------------------------
The new lexer, based on Koen's cunning parser (Text.ParserCombinators.ReadP)
wasn't quite right. It's all very cool now.
In particular:
* The H98 "lex" function should return the exact string parsed, and it
now does, aided by the new combinator ReadP.gather.
* As a result the Text.Read.Lex Lexeme type is much simpler than before
data Lexeme
= Char Char -- Quotes removed,
| String String -- escapes interpreted
| Punc String -- Punctuation, eg "(", "::"
| Ident String -- Haskell identifiers, e.g. foo, baz
| Symbol String -- Haskell symbols, e.g. >>, %
| Int Integer
| Rat Rational
| EOF
deriving (Eq,Show)
* Multi-character punctuation, like "::" was getting lexed as a Symbol,
but it should be a Punc.
* Parsing numbers wasn't quite right. "1..n" got it confused because it
got committed to a decimal point and then found a second '.'.
* The new H98 spec for Show is there, which ignores associativity.
|
|
|
|
| |
Fix non-Haddockish comments
|
|
|
|
| |
Rename libraries/core to libraries/base in the module headers.
|
|
|
|
|
| |
Remove \$Id\$ from all files: it isn't particularly useful (see
previous discussion on cvs-ghc@haskell.org), and it confuses Haddock.
|
|
|
|
|
| |
Add the single character '|' to the header comment of each module so
that Haddock will parse it as the module documentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
-------------------
Mainly derived Read
-------------------
This commit is a tangle of several things that somehow got wound up
together, I'm afraid.
The main course
~~~~~~~~~~~~~~~
Replace the derived-Read machinery with Koen's cunning new parser
combinator library. The result should be
* much smaller code sizes from derived Read
* faster execution of derived Read
WARNING: I have not thoroughly tested this stuff; I'd be glad if you did!
All the hard work is done, but there may be a few nits.
The Read class gets two new methods, not exposed
in the H98 inteface of course:
class Read a where
readsPrec :: Int -> ReadS a
readList :: ReadS [a]
readPrec :: ReadPrec a -- NEW
readListPrec :: ReadPrec [a] -- NEW
There are the following new libraries:
Text.ParserCombinators.ReadP Koens combinator parser
Text.ParserCombinators.ReadPrec Ditto, but with precedences
Text.Read.Lex An emasculated lexical analyser
that provides the functionality
of H98 'lex'
TcGenDeriv is changed to generate code that uses the new libraries.
The built-in instances of Read (List, Maybe, tuples, etc) use the new
libraries.
Other stuff
~~~~~~~~~~~
1. Some fixes the the plumbing of external-core generation. Sigbjorn
did most of the work earlier, but this commit completes the renaming and
typechecking plumbing.
2. Runtime error-generation functions, such as GHC.Err.recSelErr,
GHC.Err.recUpdErr, etc, now take an Addr#, pointing to a UTF8-encoded
C string, instead of a Haskell string. This makes the *calls* to these
functions easier to generate, and smaller too, which is a good thing.
In particular, it means that MkId.mkRecordSelectorId doesn't need to
be passed "unpackCStringId", which was GRUESOME; and that in turn means
that tcTypeAndClassDecls doesn't need to be passed unf_env, which is
a very worthwhile cleanup. Win/win situation.
3. GHC now faithfully translates do-notation using ">>" for statements
with no binding, just as the report says. While I was there I tidied
up HsDo to take a list of Ids instead of 3 (but now 4) separate Ids.
Saves a bit of code here and there. Also introduced Inst.newMethodFromName
to package a common idiom.
|
|
|
|
|
| |
Place this below the Prelude in the dependency tree, so we can import
it in Foreign.Ptr without creating a loop.
|
|
|
|
|
|
| |
- Merging from ghc/lib/std
- Add System.IO.Error
- Now builds without --make, so we can do -split-objs
|
|
|
|
| |
Make this compile again, and update with latest changes from hslibs/lang.
|
|
|
|
| |
Don't export non-H98 functions
|
|
Add Numeric library here for the time being. This is a combination of
the H98 Numeric library and a few functions from GHC's NumExts.
|