on iko/ghcjs-patch-master help sign in
Fix singletons patch (#409)

The previous patch was based on a master git commit, not on the 2.5.1 release

commit6b7c7ad95c613e2c73be19285c2d91b9e949a49d authorZhenya Vinogradov <zhenyavinogradov@gmail.com> dateTue 21 Jan 2020, 12:10 (7 years ago) parent50180fb
4 files changed+12−148
patches/ghc862/singletons-2.5.1.patch+3−37 patches/ghc863/singletons-2.5.1.patch+3−37 patches/ghc864/singletons-2.5.1.patch+3−37 patches/ghc865/singletons-2.5.1.patch+3−37
patches/ghc862/singletons-2.5.1.patch+3−37
@@ -1,37 +1,8 @@
1−From d78e5ce3fb865ec1c1659817b0bba1a1bccc692c Mon Sep 17 00:00:00 2001
2−From: Matthew Bauer <mjbauer95@gmail.com>
3−Date: Sat, 1 Jun 2019 07:04:31 -0400
4−Subject: [PATCH] Make qNewUnique return a Uniq instead of an Int
5−
6−After GHC commit
7−https://gitlab.haskell.org/ghc/ghc/commit/4ba73e00c4887b58d85131601a15d00608acaa60,
8−`Uniq` is an `Integer` instead of `Int`. The `qNewUnique` function,
9−however, currently returns an `Int` by using `fromIntegral` to
10−convert the `Integer` to an `Int`. This is potentially dangerous,
11−however, as this could truncate large `Integer`s down into smaller
12−`Int`s, which has the potential to return non-unique `Int`s.
13−
14−Instead of doing this, let's simply make `qNewUnique` return a `Uniq`
15−without any modification. The only place where `singletons` uses
16−`qNewUnique` is for the purpose of turning the `Uniq` directly into
17−a `String` anyway, so this is a perfectly fine thing to do.
18−
19−This is originally Matthew Bauer's patch from #398, which was an
20−abandoned attempt at fixing a separate GHCJS bug. Since this patch is
21−useful on its own merits, I (@RyanGlScott) have modified the commit
22−message to reflect its new purpose.
23−
24−Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
25−Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
26−---
27− src/Data/Singletons/Util.hs | 6 +++---
28− 1 file changed, 3 insertions(+), 3 deletions(-)
29−
301diff --git a/src/Data/Singletons/Util.hs b/src/Data/Singletons/Util.hs
31−index 8ffdcf96..f28d6329 100644
2+index 0f8f788..d5a06ef 100644
323--- a/src/Data/Singletons/Util.hs
334+++ b/src/Data/Singletons/Util.hs
34−@@ -91,11 +91,11 @@ qReportError :: Quasi q => String -> q ()
5+@@ -92,7 +92,7 @@ qReportError :: Quasi q => String -> q ()
356 qReportError = qReport True
367
378 -- | Generate a new Unique
@@ -40,12 +11,7 @@ index 8ffdcf96..f28d6329 100644
4011 qNewUnique = do
4112 Name _ flav <- qNewName "x"
4213 case flav of
43−- NameU n -> return $ fromIntegral n
44−+ NameU n -> return n
45− _ -> error "Internal error: `qNewName` didn't return a NameU"
46−
47− checkForRep :: Quasi q => [Name] -> q ()
48−@@ -202,7 +202,7 @@ suffixName ident symb n =
14+@@ -203,7 +203,7 @@ suffixName ident symb n =
4915 -- convert a number into both alphanumeric and symoblic forms
5016 uniquePrefixes :: String -- alphanumeric prefix
5117 -> String -- symbolic prefix
patches/ghc863/singletons-2.5.1.patch+3−37
@@ -1,37 +1,8 @@
1−From d78e5ce3fb865ec1c1659817b0bba1a1bccc692c Mon Sep 17 00:00:00 2001
2−From: Matthew Bauer <mjbauer95@gmail.com>
3−Date: Sat, 1 Jun 2019 07:04:31 -0400
4−Subject: [PATCH] Make qNewUnique return a Uniq instead of an Int
5−
6−After GHC commit
7−https://gitlab.haskell.org/ghc/ghc/commit/4ba73e00c4887b58d85131601a15d00608acaa60,
8−`Uniq` is an `Integer` instead of `Int`. The `qNewUnique` function,
9−however, currently returns an `Int` by using `fromIntegral` to
10−convert the `Integer` to an `Int`. This is potentially dangerous,
11−however, as this could truncate large `Integer`s down into smaller
12−`Int`s, which has the potential to return non-unique `Int`s.
13−
14−Instead of doing this, let's simply make `qNewUnique` return a `Uniq`
15−without any modification. The only place where `singletons` uses
16−`qNewUnique` is for the purpose of turning the `Uniq` directly into
17−a `String` anyway, so this is a perfectly fine thing to do.
18−
19−This is originally Matthew Bauer's patch from #398, which was an
20−abandoned attempt at fixing a separate GHCJS bug. Since this patch is
21−useful on its own merits, I (@RyanGlScott) have modified the commit
22−message to reflect its new purpose.
23−
24−Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
25−Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
26−---
27− src/Data/Singletons/Util.hs | 6 +++---
28− 1 file changed, 3 insertions(+), 3 deletions(-)
29−
301diff --git a/src/Data/Singletons/Util.hs b/src/Data/Singletons/Util.hs
31−index 8ffdcf96..f28d6329 100644
2+index 0f8f788..d5a06ef 100644
323--- a/src/Data/Singletons/Util.hs
334+++ b/src/Data/Singletons/Util.hs
34−@@ -91,11 +91,11 @@ qReportError :: Quasi q => String -> q ()
5+@@ -92,7 +92,7 @@ qReportError :: Quasi q => String -> q ()
356 qReportError = qReport True
367
378 -- | Generate a new Unique
@@ -40,12 +11,7 @@ index 8ffdcf96..f28d6329 100644
4011 qNewUnique = do
4112 Name _ flav <- qNewName "x"
4213 case flav of
43−- NameU n -> return $ fromIntegral n
44−+ NameU n -> return n
45− _ -> error "Internal error: `qNewName` didn't return a NameU"
46−
47− checkForRep :: Quasi q => [Name] -> q ()
48−@@ -202,7 +202,7 @@ suffixName ident symb n =
14+@@ -203,7 +203,7 @@ suffixName ident symb n =
4915 -- convert a number into both alphanumeric and symoblic forms
5016 uniquePrefixes :: String -- alphanumeric prefix
5117 -> String -- symbolic prefix
patches/ghc864/singletons-2.5.1.patch+3−37
@@ -1,37 +1,8 @@
1−From d78e5ce3fb865ec1c1659817b0bba1a1bccc692c Mon Sep 17 00:00:00 2001
2−From: Matthew Bauer <mjbauer95@gmail.com>
3−Date: Sat, 1 Jun 2019 07:04:31 -0400
4−Subject: [PATCH] Make qNewUnique return a Uniq instead of an Int
5−
6−After GHC commit
7−https://gitlab.haskell.org/ghc/ghc/commit/4ba73e00c4887b58d85131601a15d00608acaa60,
8−`Uniq` is an `Integer` instead of `Int`. The `qNewUnique` function,
9−however, currently returns an `Int` by using `fromIntegral` to
10−convert the `Integer` to an `Int`. This is potentially dangerous,
11−however, as this could truncate large `Integer`s down into smaller
12−`Int`s, which has the potential to return non-unique `Int`s.
13−
14−Instead of doing this, let's simply make `qNewUnique` return a `Uniq`
15−without any modification. The only place where `singletons` uses
16−`qNewUnique` is for the purpose of turning the `Uniq` directly into
17−a `String` anyway, so this is a perfectly fine thing to do.
18−
19−This is originally Matthew Bauer's patch from #398, which was an
20−abandoned attempt at fixing a separate GHCJS bug. Since this patch is
21−useful on its own merits, I (@RyanGlScott) have modified the commit
22−message to reflect its new purpose.
23−
24−Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
25−Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
26−---
27− src/Data/Singletons/Util.hs | 6 +++---
28− 1 file changed, 3 insertions(+), 3 deletions(-)
29−
301diff --git a/src/Data/Singletons/Util.hs b/src/Data/Singletons/Util.hs
31−index 8ffdcf96..f28d6329 100644
2+index 0f8f788..d5a06ef 100644
323--- a/src/Data/Singletons/Util.hs
334+++ b/src/Data/Singletons/Util.hs
34−@@ -91,11 +91,11 @@ qReportError :: Quasi q => String -> q ()
5+@@ -92,7 +92,7 @@ qReportError :: Quasi q => String -> q ()
356 qReportError = qReport True
367
378 -- | Generate a new Unique
@@ -40,12 +11,7 @@ index 8ffdcf96..f28d6329 100644
4011 qNewUnique = do
4112 Name _ flav <- qNewName "x"
4213 case flav of
43−- NameU n -> return $ fromIntegral n
44−+ NameU n -> return n
45− _ -> error "Internal error: `qNewName` didn't return a NameU"
46−
47− checkForRep :: Quasi q => [Name] -> q ()
48−@@ -202,7 +202,7 @@ suffixName ident symb n =
14+@@ -203,7 +203,7 @@ suffixName ident symb n =
4915 -- convert a number into both alphanumeric and symoblic forms
5016 uniquePrefixes :: String -- alphanumeric prefix
5117 -> String -- symbolic prefix
patches/ghc865/singletons-2.5.1.patch+3−37
@@ -1,37 +1,8 @@
1−From d78e5ce3fb865ec1c1659817b0bba1a1bccc692c Mon Sep 17 00:00:00 2001
2−From: Matthew Bauer <mjbauer95@gmail.com>
3−Date: Sat, 1 Jun 2019 07:04:31 -0400
4−Subject: [PATCH] Make qNewUnique return a Uniq instead of an Int
5−
6−After GHC commit
7−https://gitlab.haskell.org/ghc/ghc/commit/4ba73e00c4887b58d85131601a15d00608acaa60,
8−`Uniq` is an `Integer` instead of `Int`. The `qNewUnique` function,
9−however, currently returns an `Int` by using `fromIntegral` to
10−convert the `Integer` to an `Int`. This is potentially dangerous,
11−however, as this could truncate large `Integer`s down into smaller
12−`Int`s, which has the potential to return non-unique `Int`s.
13−
14−Instead of doing this, let's simply make `qNewUnique` return a `Uniq`
15−without any modification. The only place where `singletons` uses
16−`qNewUnique` is for the purpose of turning the `Uniq` directly into
17−a `String` anyway, so this is a perfectly fine thing to do.
18−
19−This is originally Matthew Bauer's patch from #398, which was an
20−abandoned attempt at fixing a separate GHCJS bug. Since this patch is
21−useful on its own merits, I (@RyanGlScott) have modified the commit
22−message to reflect its new purpose.
23−
24−Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
25−Co-authored-by: Ryan Scott <ryan.gl.scott@gmail.com>
26−---
27− src/Data/Singletons/Util.hs | 6 +++---
28− 1 file changed, 3 insertions(+), 3 deletions(-)
29−
301diff --git a/src/Data/Singletons/Util.hs b/src/Data/Singletons/Util.hs
31−index 8ffdcf96..f28d6329 100644
2+index 0f8f788..d5a06ef 100644
323--- a/src/Data/Singletons/Util.hs
334+++ b/src/Data/Singletons/Util.hs
34−@@ -91,11 +91,11 @@ qReportError :: Quasi q => String -> q ()
5+@@ -92,7 +92,7 @@ qReportError :: Quasi q => String -> q ()
356 qReportError = qReport True
367
378 -- | Generate a new Unique
@@ -40,12 +11,7 @@ index 8ffdcf96..f28d6329 100644
4011 qNewUnique = do
4112 Name _ flav <- qNewName "x"
4213 case flav of
43−- NameU n -> return $ fromIntegral n
44−+ NameU n -> return n
45− _ -> error "Internal error: `qNewName` didn't return a NameU"
46−
47− checkForRep :: Quasi q => [Name] -> q ()
48−@@ -202,7 +202,7 @@ suffixName ident symb n =
14+@@ -203,7 +203,7 @@ suffixName ident symb n =
4915 -- convert a number into both alphanumeric and symoblic forms
5016 uniquePrefixes :: String -- alphanumeric prefix
5117 -> String -- symbolic prefix