-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use explicit namespace specifiers when promoting/singling fixity declarations #598
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
151 changes: 151 additions & 0 deletions
151
singletons-base/tests/compile-and-dump/Singletons/T582.golden
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,151 @@ | ||
Singletons/T582.hs:(0,0)-(0,0): Splicing declarations | ||
singletons | ||
[d| infixl 4 !!! | ||
infixl 4 %%% | ||
infixl 4 `Bar` | ||
infixl 4 `foo` | ||
|
||
foo :: a -> a -> a | ||
x `foo` _ = x | ||
(%%%) :: a -> a -> a | ||
x %%% _ = x | ||
|
||
type Bar :: a -> a -> a | ||
type (!!!) :: a -> a -> a | ||
|
||
type x `Bar` y = x | ||
type x !!! y = x |] | ||
======> | ||
infixl 4 `foo` | ||
foo :: a -> a -> a | ||
foo x _ = x | ||
infixl 4 `Bar` | ||
type Bar :: a -> a -> a | ||
type Bar x y = x | ||
infixl 4 %%% | ||
(%%%) :: a -> a -> a | ||
(%%%) x _ = x | ||
infixl 4 !!! | ||
type (!!!) :: a -> a -> a | ||
type (!!!) x y = x | ||
type BarSym0 :: (~>) a ((~>) a a) | ||
data BarSym0 :: (~>) a ((~>) a a) | ||
where | ||
BarSym0KindInference :: SameKind (Apply BarSym0 arg) (BarSym1 arg) => | ||
BarSym0 a0123456789876543210 | ||
type instance Apply BarSym0 a0123456789876543210 = BarSym1 a0123456789876543210 | ||
instance SuppressUnusedWarnings BarSym0 where | ||
suppressUnusedWarnings = snd ((,) BarSym0KindInference ()) | ||
infixl 4 `BarSym0` | ||
type BarSym1 :: a -> (~>) a a | ||
data BarSym1 (a0123456789876543210 :: a) :: (~>) a a | ||
where | ||
BarSym1KindInference :: SameKind (Apply (BarSym1 a0123456789876543210) arg) (BarSym2 a0123456789876543210 arg) => | ||
BarSym1 a0123456789876543210 a0123456789876543210 | ||
type instance Apply (BarSym1 a0123456789876543210) a0123456789876543210 = Bar a0123456789876543210 a0123456789876543210 | ||
instance SuppressUnusedWarnings (BarSym1 a0123456789876543210) where | ||
suppressUnusedWarnings = snd ((,) BarSym1KindInference ()) | ||
infixl 4 `BarSym1` | ||
type BarSym2 :: a -> a -> a | ||
type family BarSym2 @a (a0123456789876543210 :: a) (a0123456789876543210 :: a) :: a where | ||
BarSym2 a0123456789876543210 a0123456789876543210 = Bar a0123456789876543210 a0123456789876543210 | ||
infixl 4 `BarSym2` | ||
type (!!!@#@$) :: (~>) a ((~>) a a) | ||
data (!!!@#@$) :: (~>) a ((~>) a a) | ||
where | ||
(:!!!@#@$###) :: SameKind (Apply (!!!@#@$) arg) ((!!!@#@$$) arg) => | ||
(!!!@#@$) a0123456789876543210 | ||
type instance Apply (!!!@#@$) a0123456789876543210 = (!!!@#@$$) a0123456789876543210 | ||
instance SuppressUnusedWarnings (!!!@#@$) where | ||
suppressUnusedWarnings = snd ((,) (:!!!@#@$###) ()) | ||
infixl 4 !!!@#@$ | ||
type (!!!@#@$$) :: a -> (~>) a a | ||
data (!!!@#@$$) (a0123456789876543210 :: a) :: (~>) a a | ||
where | ||
(:!!!@#@$$###) :: SameKind (Apply ((!!!@#@$$) a0123456789876543210) arg) ((!!!@#@$$$) a0123456789876543210 arg) => | ||
(!!!@#@$$) a0123456789876543210 a0123456789876543210 | ||
type instance Apply ((!!!@#@$$) a0123456789876543210) a0123456789876543210 = (!!!) a0123456789876543210 a0123456789876543210 | ||
instance SuppressUnusedWarnings ((!!!@#@$$) a0123456789876543210) where | ||
suppressUnusedWarnings = snd ((,) (:!!!@#@$$###) ()) | ||
infixl 4 !!!@#@$$ | ||
type (!!!@#@$$$) :: a -> a -> a | ||
type family (!!!@#@$$$) @a (a0123456789876543210 :: a) (a0123456789876543210 :: a) :: a where | ||
(!!!@#@$$$) a0123456789876543210 a0123456789876543210 = (!!!) a0123456789876543210 a0123456789876543210 | ||
infixl 4 !!!@#@$$$ | ||
type (%%%@#@$) :: (~>) a ((~>) a a) | ||
data (%%%@#@$) :: (~>) a ((~>) a a) | ||
where | ||
(:%%%@#@$###) :: SameKind (Apply (%%%@#@$) arg) ((%%%@#@$$) arg) => | ||
(%%%@#@$) a0123456789876543210 | ||
type instance Apply (%%%@#@$) a0123456789876543210 = (%%%@#@$$) a0123456789876543210 | ||
instance SuppressUnusedWarnings (%%%@#@$) where | ||
suppressUnusedWarnings = snd ((,) (:%%%@#@$###) ()) | ||
infixl 4 %%%@#@$ | ||
type (%%%@#@$$) :: a -> (~>) a a | ||
data (%%%@#@$$) (a0123456789876543210 :: a) :: (~>) a a | ||
where | ||
(:%%%@#@$$###) :: SameKind (Apply ((%%%@#@$$) a0123456789876543210) arg) ((%%%@#@$$$) a0123456789876543210 arg) => | ||
(%%%@#@$$) a0123456789876543210 a0123456789876543210 | ||
type instance Apply ((%%%@#@$$) a0123456789876543210) a0123456789876543210 = (%%%) a0123456789876543210 a0123456789876543210 | ||
instance SuppressUnusedWarnings ((%%%@#@$$) a0123456789876543210) where | ||
suppressUnusedWarnings = snd ((,) (:%%%@#@$$###) ()) | ||
infixl 4 %%%@#@$$ | ||
type (%%%@#@$$$) :: a -> a -> a | ||
type family (%%%@#@$$$) @a (a0123456789876543210 :: a) (a0123456789876543210 :: a) :: a where | ||
(%%%@#@$$$) a0123456789876543210 a0123456789876543210 = (%%%) a0123456789876543210 a0123456789876543210 | ||
infixl 4 %%%@#@$$$ | ||
type FooSym0 :: (~>) a ((~>) a a) | ||
data FooSym0 :: (~>) a ((~>) a a) | ||
where | ||
FooSym0KindInference :: SameKind (Apply FooSym0 arg) (FooSym1 arg) => | ||
FooSym0 a0123456789876543210 | ||
type instance Apply FooSym0 a0123456789876543210 = FooSym1 a0123456789876543210 | ||
instance SuppressUnusedWarnings FooSym0 where | ||
suppressUnusedWarnings = snd ((,) FooSym0KindInference ()) | ||
infixl 4 `FooSym0` | ||
type FooSym1 :: a -> (~>) a a | ||
data FooSym1 (a0123456789876543210 :: a) :: (~>) a a | ||
where | ||
FooSym1KindInference :: SameKind (Apply (FooSym1 a0123456789876543210) arg) (FooSym2 a0123456789876543210 arg) => | ||
FooSym1 a0123456789876543210 a0123456789876543210 | ||
type instance Apply (FooSym1 a0123456789876543210) a0123456789876543210 = Foo a0123456789876543210 a0123456789876543210 | ||
instance SuppressUnusedWarnings (FooSym1 a0123456789876543210) where | ||
suppressUnusedWarnings = snd ((,) FooSym1KindInference ()) | ||
infixl 4 `FooSym1` | ||
type FooSym2 :: a -> a -> a | ||
type family FooSym2 @a (a0123456789876543210 :: a) (a0123456789876543210 :: a) :: a where | ||
FooSym2 a0123456789876543210 a0123456789876543210 = Foo a0123456789876543210 a0123456789876543210 | ||
infixl 4 `FooSym2` | ||
type (%%%) :: a -> a -> a | ||
type family (%%%) @a (a :: a) (a :: a) :: a where | ||
(%%%) x _ = x | ||
type Foo :: a -> a -> a | ||
type family Foo @a (a :: a) (a :: a) :: a where | ||
Foo x _ = x | ||
infixl 4 %%% | ||
infixl 4 `Foo` | ||
infixl 4 %%%% | ||
infixl 4 `sFoo` | ||
(%%%%) :: | ||
(forall (t :: a) (t :: a). | ||
Sing t | ||
-> Sing t -> Sing (Apply (Apply (%%%@#@$) t) t :: a) :: Type) | ||
sFoo :: | ||
(forall (t :: a) (t :: a). | ||
Sing t -> Sing t -> Sing (Apply (Apply FooSym0 t) t :: a) :: Type) | ||
(%%%%) (sX :: Sing x) _ = sX | ||
sFoo (sX :: Sing x) _ = sX | ||
instance SingI ((%%%@#@$) :: (~>) a ((~>) a a)) where | ||
sing = singFun2 @(%%%@#@$) (%%%%) | ||
instance SingI d => SingI ((%%%@#@$$) (d :: a) :: (~>) a a) where | ||
sing = singFun1 @((%%%@#@$$) (d :: a)) ((%%%%) (sing @d)) | ||
instance SingI1 ((%%%@#@$$) :: a -> (~>) a a) where | ||
liftSing (s :: Sing (d :: a)) | ||
= singFun1 @((%%%@#@$$) (d :: a)) ((%%%%) s) | ||
instance SingI (FooSym0 :: (~>) a ((~>) a a)) where | ||
sing = singFun2 @FooSym0 sFoo | ||
instance SingI d => SingI (FooSym1 (d :: a) :: (~>) a a) where | ||
sing = singFun1 @(FooSym1 (d :: a)) (sFoo (sing @d)) | ||
instance SingI1 (FooSym1 :: a -> (~>) a a) where | ||
liftSing (s :: Sing (d :: a)) | ||
= singFun1 @(FooSym1 (d :: a)) (sFoo s) |
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,21 @@ | ||
module T582 where | ||
|
||
import Data.Singletons.TH | ||
|
||
$(singletons [d| | ||
infixl 4 data `foo` | ||
foo :: a -> a -> a | ||
x `foo` _ = x | ||
|
||
infixl 4 type `Bar` | ||
type Bar :: a -> a -> a | ||
type x `Bar` y = x | ||
|
||
infixl 4 data %%% | ||
(%%%) :: a -> a -> a | ||
x %%% _ = x | ||
|
||
infixl 4 type !!! | ||
type (!!!) :: a -> a -> a | ||
type x !!! y = x | ||
|]) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised to see that these generated fixity declarations seemingly lacked namespace specifiers. Some investigation reveals that the declarations actually do have namespace specifiers, but due to a GHC pretty-printing bug, the namespaces don't get printed in the
-ddump-splices
output. Thankfully, the generated code still behaves as expected, but we'll have to live with some counterintuitive golden output until that GHC bug gets fixed upstream.