Commit 3e7569bc authored by Vladislav Zavialov's avatar Vladislav Zavialov Committed by Marge Bot

Whitespace forward compatibility for proposal #229

GHC Proposal #229 changes the lexical rules of Haskell, which may
require slight whitespace adjustments in certain cases.

This patch changes formatting in a few places in GHC and its testsuite
in a way that enables it to compile under the proposed rules.
parent 93ff9197
Pipeline #11975 passed with stages
in 1032 minutes and 20 seconds
......@@ -269,7 +269,7 @@ exports_from_avail (Just (dL->L _ rdr_items)) rdr_env imports this_mod
-- See Note [Avails of associated data families]
expand_tyty_gre :: GlobalRdrElt -> [GlobalRdrElt]
expand_tyty_gre (gre @ GRE { gre_name = me, gre_par = ParentIs p })
expand_tyty_gre (gre@GRE { gre_name = me, gre_par = ParentIs p })
| isTyConName p, isTyConName me = [gre, gre{ gre_par = NoParent }]
expand_tyty_gre gre = [gre]
......
......@@ -364,11 +364,11 @@ domM = fetch domE
rootM :: Dom s Node
rootM = gets rootE
succsM :: Node -> Dom s [Node]
succsM i = gets (IS.toList . (!i) . succE)
succsM i = gets (IS.toList . (! i) . succE)
predsM :: Node -> Dom s [Node]
predsM i = gets (IS.toList . (!i) . predE)
predsM i = gets (IS.toList . (! i) . predE)
bucketM :: Node -> Dom s [Node]
bucketM i = gets (IS.toList . (!i) . bucketE)
bucketM i = gets (IS.toList . (! i) . bucketE)
sizeM :: Node -> Dom s Int
sizeM = fetch sizeE
sdnoM :: Node -> Dom s Int
......
......@@ -11,7 +11,7 @@ a ~(~[],~[],~[]) = []
b ~(x:xs:ys) = []
b ~(~x: ~xs: ~ys) = []
c ~x ~ _ ~11111 ~3.14159265 = x
c ~x ~_ ~11111 ~3.14159265 = x
d 11 = 4
d 12 = 3
......
......@@ -85,7 +85,7 @@ instance MonadFail Identity where
fail = error "Identity(fail)"
newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)}
data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r))
data TrampolineState m s r = Done r | Suspend !(s (Trampoline m s r))
instance (Monad m, Functor s) => Functor (Trampoline m s) where
fmap = liftM
......@@ -103,11 +103,11 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where
instance (MonadFail m, Functor s) => MonadFail (Trampoline m s) where
fail = error "Trampoline(fail)"
data Yield x y = Yield! x y
data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y)
data Await x y = Await! (x -> y)
data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = trace "fmap await" $ Await (f . g)
......
......@@ -76,7 +76,7 @@ data TrampolineState s m r =
-- | Trampoline computation is finished with final value /r/.
Done r
-- | Computation is suspended, its remainder is embedded in the functor /s/.
| Suspend! (s (Trampoline s m r))
| Suspend !(s (Trampoline s m r))
instance (Functor s, Monad m) => Functor (Trampoline s m) where
fmap = liftM
......@@ -101,11 +101,11 @@ instance (Functor s, ParallelizableMonad m) => ParallelizableMonad (Trampoline s
instance Functor s => MonadTrans (Trampoline s) where
lift = Trampoline . liftM Done
data Yield x y = Yield! x y
data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = Yield x (f y)
data Await x y = Await! (x -> y)
data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = Await (f . g)
......
-- !!! Illegal ~ in expression
module M where
f x = x~1
f x = x ~1
mod70.hs:3:8: error: Pattern syntax in expression context: ~1
mod70.hs:3:9: error: Pattern syntax in expression context: ~1
module T13600b where
f !(Just x) = f !! x
f !y = head f
f ! (Just x) = f !! x
f ! y = head f
x = [1,2,3] ! Just 1
where
f !(Just x) = f !! x
f !y = head f
f ! (Just x) = f !! x
f ! y = head f
T13600b.hs:3:3: warning: [-Wmissing-space-after-bang (in -Wdefault)]
Did you forget to enable BangPatterns?
If you mean to bind (!) then perhaps you want
to add a space after the bang for clarity.
T13600b.hs:4:3: warning: [-Wmissing-space-after-bang (in -Wdefault)]
Did you forget to enable BangPatterns?
If you mean to bind (!) then perhaps you want
to add a space after the bang for clarity.
T13600b.hs:8:7: warning: [-Wmissing-space-after-bang (in -Wdefault)]
Did you forget to enable BangPatterns?
If you mean to bind (!) then perhaps you want
to add a space after the bang for clarity.
T13600b.hs:9:7: warning: [-Wmissing-space-after-bang (in -Wdefault)]
Did you forget to enable BangPatterns?
If you mean to bind (!) then perhaps you want
to add a space after the bang for clarity.
......@@ -3,9 +3,9 @@
module Main where
data Foo1 = Crunch1 ! Int ! Int Int deriving( Show )
data Foo1 = Crunch1 !Int !Int Int deriving( Show )
data Foo2 = Crunch2 ! Int Int Int deriving( Show )
data Foo2 = Crunch2 !Int Int Int deriving( Show )
main = do
print (Crunch1 (1+1) (2+2) (3+3))
......
......@@ -3,5 +3,5 @@ module ShouldFail where
-- !!! Pattern syntax in expressions
f x = x @ x
f x = x@x
......@@ -83,7 +83,7 @@ instance Monad Identity where
m >>= k = k (runIdentity m)
newtype Trampoline m s r = Trampoline {bounce :: m (TrampolineState m s r)}
data TrampolineState m s r = Done r | Suspend! (s (Trampoline m s r))
data TrampolineState m s r = Done r | Suspend !(s (Trampoline m s r))
instance (Monad m, Functor s) => Functor (Trampoline m s) where
fmap = liftM
......@@ -101,11 +101,11 @@ instance (Monad m, Functor s) => Monad (Trampoline m s) where
instance (Monad m, Functor s) => MonadFail (Trampoline m s) where
fail = error
data Yield x y = Yield! x y
data Yield x y = Yield !x y
instance Functor (Yield x) where
fmap f (Yield x y) = trace "fmap yield" $ Yield x (f y)
data Await x y = Await! (x -> y)
data Await x y = Await !(x -> y)
instance Functor (Await x) where
fmap f (Await g) = trace "fmap await" $ Await (f . g)
......
......@@ -2,6 +2,6 @@
module T11313 where
x = fmap @ (*)
x = fmap @(*)
-- test error message output, which was quite silly before
T11313.hs:5:13: error:
T11313.hs:5:12: error:
• Expected kind ‘* -> *’, but ‘*’ has kind ‘*’
• In the type ‘(*)’
In the expression: fmap @(*)
......
......@@ -2,4 +2,4 @@
module T12529 where
f = p @ Int
f = p @Int
......@@ -4,7 +4,7 @@
module ShouldFail where
data S = S { x::Int, y:: ! Int }
data S = S { x::Int, y:: !Int }
data T = T Int !Int
data U = U Int Int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment