summaryrefslogtreecommitdiff
path: root/libraries/base/GHC/IO/Encoding
Commit message (Collapse)AuthorAgeFilesLines
* Use unboxed codebuffers in baseJosh Meredith2023-05-157-491/+591
| | | | | Metric Decrease: encodingAllocations
* Replace the implementation of CodeBuffers with unboxed typesJosh Meredith2023-05-151-11/+50
|
* Misc cleanupKrzysztof Gogolewski2023-04-171-1/+0
| | | | | | - Use dedicated list functions - Make cloneBndrs and cloneRecIdBndrs monadic - Fix invalid haddock comments in libraries/base
* JS: replace "js" architecture with "javascript"Sylvain Henry2023-02-061-1/+1
| | | | | | | | | | | | | | | Despite Cabal supporting any architecture name, `cabal --check` only supports a few built-in ones. Sadly `cabal --check` is used by Hackage hence using any non built-in name in a package (e.g. `arch(js)`) is rejected and the package is prevented from being uploaded on Hackage. Luckily built-in support for the `javascript` architecture was added for GHCJS a while ago. In order to allow newer `base` to be uploaded on Hackage we make the switch from `js` to `javascript` architecture. Fixes #22740. Co-authored-by: Ben Gamari <ben@smart-cactus.org>
* Add Javascript backendSylvain Henry2022-11-291-0/+6
| | | | | | | | | | | | | | | Add JS backend adapted from the GHCJS project by Luite Stegeman. Some features haven't been ported or implemented yet. Tests for these features have been disabled with an associated gitlab ticket. Bump array submodule Work funded by IOG. Co-authored-by: Jeffrey Young <jeffrey.young@iohk.io> Co-authored-by: Luite Stegeman <stegeman@gmail.com> Co-authored-by: Josh Meredith <joshmeredith2008@gmail.com>
* Add a Note summarising GHC's UTF-8 implementationsBen Gamari2022-07-221-0/+4
| | | | | GHC has a somewhat dizzying array of UTF-8 implementations. This note describes why this is the case.
* typosEric Lindblad2022-07-181-1/+1
|
* Improve error messages from GHC.IO.Encoding.FailureBodigrim2022-04-221-8/+12
|
* Fix a few Note inconsistenciesBen Gamari2022-02-011-1/+0
|
* Revert "Data.List specialization to []"Matthew Pickering2021-12-031-1/+1
| | | | | | | | | | This reverts commit bddecda1a4c96da21e3f5211743ce5e4c78793a2. This implements the first step in the plan formulated in #20025 to improve the communication and migration strategy for the proposed changes to Data.List. Requires changing the haddock submodule to update the test output.
* Data.List specialization to []Oleg Grenrus2021-04-011-1/+1
| | | | | | | - Remove GHC.OldList - Remove Data.OldList - compat-unqualified-imports is no-op - update haddock submodule
* Fix array and cleanup conversion primops (#19026)Sylvain Henry2021-03-034-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first change makes the array ones use the proper fixed-size types, which also means that just like before, they can be used without explicit conversions with the boxed sized types. (Before, it was Int# / Word# on both sides, now it is fixed sized on both sides). For the second change, don't use "extend" or "narrow" in some of the user-facing primops names for conversions. - Names like `narrowInt32#` are misleading when `Int` is 32-bits. - Names like `extendInt64#` are flat-out wrong when `Int is 32-bits. - `narrow{Int,Word}<N>#` however map a type to itself, and so don't suffer from this problem. They are left as-is. These changes are batched together because Alex happend to use the array ops. We can only use released versions of Alex at this time, sadly, and I don't want to have to have a release thatwon't work for the final GHC 9.2. So by combining these we get all the changes for Alex done at once. Bump hackage state in a few places, and also make that workflow slightly easier for the future. Bump minimum Alex version Bump Cabal, array, bytestring, containers, text, and binary submodules
* [Sized Cmm] properly retain sizes.Moritz Angermann2020-11-264-27/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces all Word<N> = W<N># Word# and Int<N> = I<N># Int# with Word<N> = W<N># Word<N># and Int<N> = I<N># Int<N>#, thus providing us with properly sized primitives in the codegenerator instead of pretending they are all full machine words. This came up when implementing darwinpcs for arm64. The darwinpcs reqires us to pack function argugments in excess of registers on the stack. While most procedure call standards (pcs) assume arguments are just passed in 8 byte slots; and thus the caller does not know the exact signature to make the call, darwinpcs requires us to adhere to the prototype, and thus have the correct sizes. If we specify CInt in the FFI call, it should correspond to the C int, and not just be Word sized, when it's only half the size. This does change the expected output of T16402 but the new result is no less correct as it eliminates the narrowing (instead of the `and` as was previously done). Bumps the array, bytestring, text, and binary submodules. Co-Authored-By: Ben Gamari <ben@well-typed.com> Metric Increase: T13701 T14697
* Remove redundant "do", "return" and language extensions from baseHécate2020-09-232-2/+2
|
* Re-add BangPatterns to CodePage.hsHécate2020-08-131-0/+2
|
* Remove all the unnecessary LANGUAGE pragmasHécate2020-08-051-2/+3
|
* winio: Don't drop buffer offset in byteView/cwcharViewAndreas Klebinger2020-07-151-2/+2
|
* winio: Refactor Buffer structures to be able to track async operationsTamar Christina2020-07-152-23/+12
|
* Fix typos, via a Levenshtein-style correctorBrian Wignall2020-01-041-1/+1
|
* fixup! Fix endian handling w.r.t. CPP macro WORDS_BIGENDIANStefan Schulze Frielinghaus2019-12-241-1/+1
|
* Fix endian handling w.r.t. CPP macro WORDS_BIGENDIANStefan Schulze Frielinghaus2019-12-241-0/+3
| | | | | | Include header file `ghcautoconf.h` where the CPP macro `WORDS_BIGENDIAN` is defined. This finally fixes #17337 (in conjunction with commit 6c59cc71dc).
* Remove OPTIONS_HADDOCK hide in favour for not-homeAdam Sandberg Eriksson2019-01-061-1/+1
| | | | GHC Trac Issues: #15447
* Fix ambiguous/out-of-scope Haddock identifiersAlec Theriault2018-08-212-4/+4
| | | | | | | | | | | | | | | | | This drastically cuts down on the number of Haddock warnings when making docs for `base`. Plus this means more actual links end up in the docs! Also fixed other small mostly markup issues in the documentation along the way. This is a docs-only change. Reviewers: hvr, bgamari, thomie Reviewed By: thomie Subscribers: thomie, rwbarton, carter Differential Revision: https://phabricator.haskell.org/D5055
* Add @since annotations for derived instances in baseChaitanya Koparkar2018-03-022-2/+5
| | | | | | | | | | | | | | Test Plan: ./validate Reviewers: hvr, goldfire, bgamari, RyanGlScott Reviewed By: RyanGlScott Subscribers: rwbarton, thomie, carter GHC Trac Issues: #11767 Differential Revision: https://phabricator.haskell.org/D4452
* Fix typo in accessor nameGabor Greif2017-10-301-2/+2
| | | | and in comments
* Prefer #if defined to #ifdefBen Gamari2017-04-283-7/+7
| | | | Our new CPP linter enforces this.
* Fix naming of the native latin1 encodingsKai Ruemmler2016-12-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | textEncodingName is notjust a string, it must be a valid input for mkTextEncoding, as stated in libraries/base/GHC/IO/Encoding/Types.hs. Test Plan: A working latin1 locale is required on the system. Reason: ghc's initial locale encoding defaults to ASCII, if either an unknown locale or unknown charset is used. For the bug to show up, ghc must start up using the latin1 encoding. From main directory in ghc do: $ ./configure && make clean && make boot && make inplace/bin/ghc-stage2 $ LC_CTYPE="de_DE.ISO-8859-1" ./inplace/bin/ghc-stage2 Before the patch, the last line leads to the exception thrown: ghc-stage2: mkTextEncoding: does not exist (unknown encoding:ISO8859-1(checked)//TRANSLIT) After the patch, ghc-stage2 prints a short usage summary as expected. Moreover, $ make test TEST=encoding005 continues to pass after the patch. Reviewers: austin, hvr, rwbarton, bgamari Reviewed By: bgamari Subscribers: mpickering, rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D2667
* Add @since annotations to base instancesSeraphime Kirkovski2016-06-062-0/+2
| | | | | | | | | | | | | | | | | | Add @since annotations to instances in `base`. Test Plan: * ./validate # some commets shouldn't break the build * review the annotations for absurdities. Reviewers: ekmett, goldfire, RyanGlScott, austin, hvr, bgamari Reviewed By: RyanGlScott, hvr, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2277 GHC Trac Issues: #11767
* Allow CallStacks to be frozenEric Seidel2015-12-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Start using `-W` instead of `-f(no-)warn` in some placesHerbert Valerio Riedel2015-12-161-1/+1
| | | | | | | | | | | | | | | | | | This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases introduced via 2206fa8cdb120932 / #11218, in cases which are guaranteed to be invoked with recent enough GHC (i.e. the stage1+ GHC). After this commit, mostly the compiler and the testsuite remain using `-f(wo-)warn...` because the compiler needs to be bootstrappable with older GHCs, while for the testsuite it's convenient to be able to quickly compare the behavior to older GHCs (which may not support the new flags yet). The compiler-part can be updated to use the new flags once GHC 8.3 development starts. Reviewed By: quchen Differential Revision: https://phabricator.haskell.org/D1637
* More typos in comments/docsGabor Greif2015-12-091-1/+1
|
* base: Update `@since 4.8.2` annotations (re #11026)Herbert Valerio Riedel2015-11-021-2/+2
| | | | This missed to perform in f8ba4b55cc3a061458f5cfabf17de96128defbbb
* Update encoding001 to test the full range of non-surrogate code pointsReid Barton2015-07-231-4/+5
| | | | | | | | | | | | | | | | | GHC has used surrogate code points for roundtripping since 7.4. See Note [Roundtripping]. Also, improve the wording of that Note slightly. Test Plan: validate still passes Reviewers: austin, hvr, bgamari Reviewed By: bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1087
* When iconv is unavailable, use an ASCII encoding to encode ASCIIReid Barton2015-07-211-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D898 and D1059 implemented a fallback behavior to handle the case that the end user's iconv installation is broken (typically due to running inside a chroot in which the necessary locale files and/or gconv modules have not been installed). In this case, if the program requests an ASCII locale, GHC's char8 encoding is used rather than the program failing. However, silently mangling data like char8 does when the programmer did not ask for it is poor behavior, for reasons described in D1059. This commit implements an ASCII encoding and uses it in the fallback case when iconv is unavailable and the user has requested ASCII. Test Plan: Added tests for the encodings defined in Latin1. Also, manually ran a statically-linked executable of that test in a chroot and the tests passed (up to the ones that call mkTextEncoding "LATIN1", since there is no fallback from iconv for that case yet). Reviewers: austin, hvr, hsyl20, bgamari Reviewed By: hsyl20, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1085 GHC Trac Issues: #7695, #10623
* Fix self-contained handling of ASCII encodingBen Gamari2015-07-101-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | D898 was primarily intended to fix hangs in the event that iconv was unavailable (namely #10298 and #7695). In addition to this fix, it also introduced self-contained handling of ANSI terminals to allow compiled executables to run in minimal environments lacking iconv. However, the behavior that the patch introduced is highly suspicious. Specifically, it gives the user a UTF-8 encoding even if they requested ASCII. This has the potential to break quite a lot of code. At very least it breaks GHC's Unicode terminal detection logic, which attempts to catch an invalid character when encoding a pair of smart-quotes. Of course, this exception will never be thrown if a UTF-8 encoder is used. Here we use the `char8` encoding to handle requests for ASCII encodings in the event that we find iconv to be non-functional. Fixes #10623. Test Plan: Validate with T8959a Reviewers: rwbarton, hvr, austin, hsyl20 Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1059 GHC Trac Issues: #10623
* Removed unused constrained which causes build to fail with -WerrorTamar Christina2015-03-021-1/+1
| | | | | | | | | | | | | | | | Summary: Unused Show constraint is cauzing validate build failures because of -Werror. Removing constraint solves the problem Test Plan: validate Reviewers: austin, hvr Reviewed By: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D690
* Convert `/Since: .../` to new `@since ...` syntaxHerbert Valerio Riedel2014-12-165-11/+11
| | | | | | 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`)
* Be consistent with placement of Safe Haskell mode at top of fileDavid Terei2014-11-211-1/+3
|
* Improve Safe Haskell bounds for changes to base over timeDavid Terei2014-11-211-0/+1
|
* Update Foreign.* for Safe Haskell now that they're safe by defaultDavid Terei2014-11-211-1/+1
|
* `M-x delete-trailing-whitespace` & `M-x untabify`Herbert Valerio Riedel2014-10-251-15/+15
| | | | This removes all remaining tabs from `base`'s source code
* `M-x delete-trailing-whitespace` & `M-x untabify`Herbert Valerio Riedel2014-09-244-27/+27
| | | | ...several modules in `base` recently touched by me
* Fix windows breakage from 5ed12810e0972b1e due to import cyclesHerbert Valerio Riedel2014-09-222-3/+2
| | | | Refs #9586
* Move `Maybe`-typedef into GHC.BaseHerbert Valerio Riedel2014-09-163-5/+0
| | | | | | | This is preparatory work for reintroducing SPECIALISEs that were lost in d94de87252d0fe2ae97341d186b03a2fbe136b04 Differential Revision: https://phabricator.haskell.org/D214
* Add missing/remove redundant `{-# LANGUAGE CPP #-}`sHerbert Valerio Riedel2013-09-282-2/+2
| | | | | | | | | | The `CPP` forgotten were in windows-specific modules, and the redundant `CPP` files were removed in some `.hsc` files. Note: `.hsc` files only require `{-# LANGUAGE CPP #-}` annotations if they use `##`, as `hsc2hs` removes all non-escaped `#`-directives. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Drop redundant `{-# LANGUAGE #-}` pragmasHerbert Valerio Riedel2013-09-284-4/+3
| | | | | | | | | | | | | This removes language pragmas from Haskell modules which are implicitly active with `default-language: Haskell2010`. Specifically, the following language extension pragmas are removed by this commit: - PatternGuards - ForeignFunctionInterface - EmptyDataDecls - NoBangPatterns Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Remove obsolete pre-Haddock-2 `#hide` pragmasHerbert Valerio Riedel2013-09-231-1/+1
| | | | | | | | | | | | The now obsolete (and redundant) `#hide` pragmas have been superseded by `{-# OPTIONS_HADDOCK hide #-}` pragmas which are used by most of the affected modules anyway. This commit also adds proper `{-# OPTIONS_HADDOCK hide #-}` pragmas to `GHC.Desugar` and `GHC.IO.Encoding.Iconv` which had only the ineffective `#hide` annotation. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Add Haddock `/Since: 4.4.0.0/` comments to symbolsHerbert Valerio Riedel2013-09-225-0/+12
| | | | | | | | | | This commit retroactively adds `/Since: 4.4.0.0/` annotations to symbols newly added/exposed in `base-4.4.0.0` (as shipped with GHC 7.2.1). See also 6368362f which adds the respective annotation for symbols newly added in `base-4.7.0.0` (that goes together with GHC 7.8.1). Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
* Constant-fold `__GLASGOW_HASKELL__` CPP conditionalsHerbert Valerio Riedel2013-09-171-2/+1
| | | | | | | | | | 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>
* One more GHC.Err import eliminatedSimon Peyton Jones2013-06-111-1/+0
| | | | (This one only shows up on Windows.)