retrie-0.1.0.0: tests/inputs/Operator.test
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
-l Operator.print
-l Operator.printAt
-u Operator.f
===
module Operator where
main :: IO ()
main = do
- putStrLn $ show $ 3 + 4
+ print $ 3 + 4
-- lets make sure
- putStrLn .@@@ show .@@@ foo ||
+ print $ foo ||
-- that comments end up in the right place
bar ||
baz &&
-- even this one
quux
-- lets also make sure
- putStrLn $ show $ foo
+ print $ foo
-- that these comments end up in the right place
|| bar
|| baz
-- even when the operator is leading
&& quux
return ({- comment -} x >= 1 || y >= 2)
- putStrLn {- comment here -} $ show $ foo || bar
- putStrLn $ {- comment here -} show $ foo || bar
- putStrLn $ show {- comment here -} $ foo || bar
- putStrLn $ show $ {- comment here -} foo || bar
- putStrLn $ show $ foo {- comment here -} || bar
- putStrLn $ show $ foo || {- comment here -} bar
- putStrLn $ show $ foo || bar {- comment here -}
+ print $ foo || bar
+ print $ foo || bar
+ print $ foo || bar
+ print $ {- comment here -} foo || bar
+ print $ foo {- comment here -} || bar
+ print $ foo || {- comment here -} bar
+ print $ foo || bar {- comment here -}
- putStrLn (show $ foo || bar)
- putStrLn (show (foo || bar))
+ print $ foo || bar
+ print $ foo || bar
{-# RULES "print" forall x. putStrLn $ show $ x = print $ x #-}
f :: Int -> Bool
f x = x == 2
g :: Int -> Bool
-g y = f y /= False
+g y = (y == 2) /= False
roundtrip :: IO [a]
roundtrip = return $ mconcat
[ timeToText $ time_enrolled - mod time_enrolled t
, ":"
]
-- Ensure local fixity declarations are handled properly
(.@@@) :: (a -> b) -> a -> b
f .@@@ x = f x
infixr 0 .@@@
{-# RULES "printAt" forall x. putStrLn .@@@ show .@@@ x = print $ x #-}