-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport functions introduced in base-4.16
Checks off the `base-4.16.0.0` boxes in #24.
- Loading branch information
1 parent
847aa35
commit 0dbe973
Showing
11 changed files
with
106 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{-# LANGUAGE CPP, NoImplicitPrelude, PackageImports #-} | ||
module Text.Read.Lex.Compat ( | ||
module Base | ||
) where | ||
|
||
import "base-compat" Text.Read.Lex.Compat as Base |
8 changes: 8 additions & 0 deletions
8
base-compat-batteries/src/Text/Read/Lex/Compat/Repl/Batteries.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{-# LANGUAGE PackageImports #-} | ||
{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} | ||
-- | Reexports "Text.Read.Lex.Compat" | ||
-- from a globally unique namespace. | ||
module Text.Read.Lex.Compat.Repl.Batteries ( | ||
module Text.Read.Lex.Compat | ||
) where | ||
import "this" Text.Read.Lex.Compat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{-# LANGUAGE CPP, NoImplicitPrelude #-} | ||
#if __GLASGOW_HASKELL__ >= 702 | ||
{-# LANGUAGE Trustworthy #-} | ||
#endif | ||
module Text.Read.Lex.Compat ( | ||
module Base | ||
, readBinP | ||
) where | ||
|
||
import Text.Read.Lex as Base | ||
|
||
#if !(MIN_VERSION_base(4,16,0)) | ||
import Data.Char (ord) | ||
import Prelude | ||
import Text.ParserCombinators.ReadP (ReadP) | ||
#endif | ||
|
||
#if !(MIN_VERSION_base(4,16,0)) | ||
readBinP :: (Eq a, Num a) => ReadP a | ||
readBinP = readIntP'2 | ||
{-# SPECIALISE readBinP :: ReadP Integer #-} | ||
|
||
readIntP'2 :: (Eq a, Num a) => ReadP a | ||
readIntP'2 = readIntP 2 isDigit valDigit | ||
where | ||
isDigit c = maybe False (const True) (valDig2 c) | ||
valDigit c = maybe 0 id (valDig2 c) | ||
{-# SPECIALISE readIntP'2 :: ReadP Integer #-} | ||
|
||
valDig2 :: Char -> Maybe Int | ||
valDig2 c | ||
| '0' <= c && c <= '1' = Just (ord c - ord '0') | ||
| otherwise = Nothing | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{-# LANGUAGE PackageImports #-} | ||
{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} | ||
-- | Reexports "Text.Read.Lex.Compat" | ||
-- from a globally unique namespace. | ||
module Text.Read.Lex.Compat.Repl ( | ||
module Text.Read.Lex.Compat | ||
) where | ||
import "this" Text.Read.Lex.Compat |