Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/failing/Do.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ test1 = do let x = 1

test2 y = do x <- y

test3 = do return 1
return 2
test3 = do pure 1
pure 2
2 changes: 1 addition & 1 deletion examples/failing/SkolemEscape2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ import Control.Monad.ST

test _ = do
r <- runST (newSTRef 0)
return 0
pure 0
3 changes: 2 additions & 1 deletion examples/failing/Superclasses5.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Main where

import Prelude
import Control.Monad.Eff.Console (logShow)

class Su a where
su :: a -> a
Expand All @@ -22,4 +23,4 @@ instance clNumber :: Cl Number where
test :: forall a. (Cl a) => a -> Array a
test x = su [cl x x]

main = Control.Monad.Eff.Console.print $ test 10.0
main = logShow $ test 10.0
2 changes: 1 addition & 1 deletion examples/failing/TypeError.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ module Main where

import Prelude

test = 1 ++ "A"
test = 1 <> "A"
4 changes: 2 additions & 2 deletions examples/manual/passing/Module.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module M1 where
data Foo = Foo String

foo :: M1.Foo -> String
foo = \f -> case f of Foo s -> s ++ "foo"
foo = \f -> case f of Foo s -> s <> "foo"

bar :: Foo -> String
bar = foo
Expand All @@ -21,7 +21,7 @@ module M2 where
baz = M1.foo

match :: M1.Foo -> String
match = \f -> case f of M1.Foo s -> s ++ "foo"
match = \f -> case f of M1.Foo s -> s <> "foo"

module Main where

Expand Down
4 changes: 2 additions & 2 deletions examples/manual/passing/TransitiveImport.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ module Main where
import Control.Monad.Eff.Console

main = do
print (middle unit)
logShow (middle unit)
trace "Done"
return unit
pure unit
2 changes: 1 addition & 1 deletion examples/passing/1664.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ newtype IdentityEff e a = IdentityEff (Eff e (Identity a))
test :: forall e a. IdentityEff e a -> IdentityEff e Unit
test (IdentityEff action) = IdentityEff $ do
(Identity x :: Identity _) <- action
return $ Identity unit
pure $ Identity unit

main = log "Done"
4 changes: 2 additions & 2 deletions examples/passing/CaseInDo.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Control.Monad.Eff.Console
import Control.Monad.Eff

doIt :: forall eff. Eff eff Boolean
doIt = return true
doIt = pure true

set = do
log "Testing..."
case 0 of
0 -> doIt
_ -> return false
_ -> pure false

main = do
b <- set
Expand Down
4 changes: 2 additions & 2 deletions examples/passing/CaseMultipleExpressions.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import Control.Monad.Eff.Console
import Control.Monad.Eff

doIt :: forall eff. Eff eff Boolean
doIt = return true
doIt = pure true

set = do
log "Testing..."
case 42, 10 of
42, 10 -> doIt
_ , _ -> return false
_ , _ -> pure false

main = do
b <- set
Expand Down
4 changes: 2 additions & 2 deletions examples/passing/Collatz.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ collatz n = runPure (runST (do
modifySTRef count $ (+) 1
m <- readSTRef r
writeSTRef r $ if m `mod` 2 == 0 then m / 2 else 3 * m + 1
return $ m == 1
pure $ m == 1
readSTRef count))

main = Control.Monad.Eff.Console.print $ collatz 1000
main = Control.Monad.Eff.Console.logShow $ collatz 1000
2 changes: 1 addition & 1 deletion examples/passing/Console.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Control.Monad.Eff
import Control.Monad.Eff.Console

replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
replicateM_ 0.0 _ = return {}
replicateM_ 0.0 _ = pure {}
replicateM_ n act = do
act
replicateM_ (n - 1.0) act
Expand Down
2 changes: 1 addition & 1 deletion examples/passing/ContextSimplification.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ shout = log <<< (<> "!") <<< show
-- Here, we should simplify the context so that only one Show
-- constraint is added.
usesShowTwice true = shout
usesShowTwice false = print
usesShowTwice false = logShow

main = usesShowTwice true "Done"
2 changes: 1 addition & 1 deletion examples/passing/DeepCase.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ f x y =
x -> 1.0 + x * x
in g + x + y

main = print $ f 1.0 10.0
main = logShow $ f 1.0 10.0
4 changes: 2 additions & 2 deletions examples/passing/Eff.purs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ test3 = pureST (do

main = do
test1
Control.Monad.Eff.Console.print test2
Control.Monad.Eff.Console.print test3
Control.Monad.Eff.Console.logShow test2
Control.Monad.Eff.Console.logShow test3
2 changes: 1 addition & 1 deletion examples/passing/EqOrd.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ instance ordPair :: (Ord a, Ord b) => Ord (Pair a b) where
instance eqPair :: (Eq a, Eq b) => Eq (Pair a b) where
eq (Pair a1 b1) (Pair a2 b2) = a1 == a2 && b1 == b2

main = Control.Monad.Eff.Console.print $ Pair 1.0 2.0 == Pair 1.0 2.0
main = Control.Monad.Eff.Console.logShow $ Pair 1.0 2.0 == Pair 1.0 2.0
2 changes: 1 addition & 1 deletion examples/passing/ExtendedInfixOperators.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ null _ = false
test = [1.0, 2.0, 3.0] `comparing null` [4.0, 5.0, 6.0]

main = do
Control.Monad.Eff.Console.print test
Control.Monad.Eff.Console.logShow test
2 changes: 1 addition & 1 deletion examples/passing/Fib.purs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ main = runST (do
n2' <- readSTRef n2
writeSTRef n2 $ n1' + n2'
writeSTRef n1 n2'
Control.Monad.Eff.Console.print n2')
Control.Monad.Eff.Console.logShow n2')
2 changes: 1 addition & 1 deletion examples/passing/FinalTagless.purs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ runId (Id a) = a
three :: Expr Number
three = add (num 1.0) (num 2.0)

main = Control.Monad.Eff.Console.print $ runId three
main = Control.Monad.Eff.Console.logShow $ runId three
2 changes: 1 addition & 1 deletion examples/passing/ImportHiding.purs
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class Show a where
data Unit = X | Y

main = do
print show
logShow show
2 changes: 1 addition & 1 deletion examples/passing/InferRecFunWithConstrainedArgument.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import Prelude
test 100.0 = 100.0
test n = test(1.0 + n)

main = Control.Monad.Eff.Console.print $ test 0.0
main = Control.Monad.Eff.Console.logShow $ test 0.0
14 changes: 7 additions & 7 deletions examples/passing/Let.purs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ test10 _ =
in f 10.0

main = do
Control.Monad.Eff.Console.print (test1 1.0)
Control.Monad.Eff.Console.print (test2 1.0 2.0)
Control.Monad.Eff.Console.print test3
Control.Monad.Eff.Console.print test4
Control.Monad.Eff.Console.print test5
Control.Monad.Eff.Console.print test7
Control.Monad.Eff.Console.print (test8 100.0)
Control.Monad.Eff.Console.logShow (test1 1.0)
Control.Monad.Eff.Console.logShow (test2 1.0 2.0)
Control.Monad.Eff.Console.logShow test3
Control.Monad.Eff.Console.logShow test4
Control.Monad.Eff.Console.logShow test5
Control.Monad.Eff.Console.logShow test7
Control.Monad.Eff.Console.logShow (test8 100.0)
2 changes: 1 addition & 1 deletion examples/passing/Let2.purs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ test =
x = f 1.0
in not x

main = Control.Monad.Eff.Console.print test
main = Control.Monad.Eff.Console.logShow test
2 changes: 1 addition & 1 deletion examples/passing/ModuleExport.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ module Main where
import A

main = do
print (show 1.0)
logShow (show 1.0)
2 changes: 1 addition & 1 deletion examples/passing/ModuleExportDupes.purs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ module Main where
import Prelude

main = do
print (show 1.0)
logShow (show 1.0)
2 changes: 1 addition & 1 deletion examples/passing/ModuleExportExcluded.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ module Main where
otherwise = false

main = do
print "1.0"
logShow "1.0"
2 changes: 1 addition & 1 deletion examples/passing/ModuleExportQualified.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ module Main where
import qualified A as B

main = do
print (B.show 1.0)
logShow (B.show 1.0)
2 changes: 1 addition & 1 deletion examples/passing/ModuleExportSelf.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ module Main where
bar = true

main = do
print (show bar)
logShow (show bar)
2 changes: 1 addition & 1 deletion examples/passing/MonadState.purs
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ modify f =
same :: forall a. (a -> a) -> (a -> a)
same = id

main = print $ runState 0 (modify (+ 1))
main = logShow $ runState 0 (modify (+ 1))
4 changes: 2 additions & 2 deletions examples/passing/MultiArgFunctions.purs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Main where

import Prelude
import Data.Function
import Data.Function.Uncurried
import Control.Monad.Eff
import Control.Monad.Eff.Console

Expand All @@ -23,5 +23,5 @@ main = do
runFn8 (mkFn8 $ \a b c d e f g h -> log $ show [a, b, c, d, e, f, g, h]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
runFn9 (mkFn9 $ \a b c d e f g h i -> log $ show [a, b, c, d, e, f, g, h, i]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
runFn10 (mkFn10 $ \a b c d e f g h i j-> log $ show [a, b, c, d, e, f, g, h, i, j]) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
print $ runFn2 g 0.0 0.0
logShow $ runFn2 g 0.0 0.0
log "Done!"
2 changes: 1 addition & 1 deletion examples/passing/NestedTypeSynonyms.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ type Y = X -> X
fn :: Y
fn a = a

main = Control.Monad.Eff.Console.print (fn "Done")
main = Control.Monad.Eff.Console.logShow (fn "Done")
10 changes: 5 additions & 5 deletions examples/passing/Newtype.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import Control.Monad.Eff.Console
newtype Thing = Thing String

instance showThing :: Show Thing where
show (Thing x) = "Thing " ++ show x
show (Thing x) = "Thing " <> show x

newtype Box a = Box a

instance showBox :: (Show a) => Show (Box a) where
show (Box x) = "Box " ++ show x
show (Box x) = "Box " <> show x

apply f x = f x

main = do
print $ Thing "hello"
print $ Box 42.0
print $ apply Box 9000.0
logShow $ Thing "hello"
logShow $ Box 42.0
logShow $ apply Box 9000.0
log "Done"
2 changes: 1 addition & 1 deletion examples/passing/ObjectGetter.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ getX = _.x
point = { x: 1.0, y: 0.0 }

main = do
Control.Monad.Eff.Console.print $ getX point
Control.Monad.Eff.Console.logShow $ getX point
Control.Monad.Eff.Console.log $ _." 123 string Prop Name " { " 123 string Prop Name ": "OK" }
Control.Monad.Eff.Console.log $ (_.x >>> _.y) { x: { y: "Nested" } }
Control.Monad.Eff.Console.log $ _.value { value: "Done!" }
2 changes: 1 addition & 1 deletion examples/passing/ObjectUpdater.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Control.Monad.Eff.Console
import Test.Assert

getValue :: forall e. Eff (| e) Boolean
getValue = return true
getValue = pure true

main = do
let record = { value: false }
Expand Down
6 changes: 3 additions & 3 deletions examples/passing/ObjectWildcards.purs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import Test.Assert
mkRecord = { foo: _, bar: _, baz: "baz" }

getValue :: forall e. Eff (| e) Boolean
getValue = return true
getValue = pure true

main = do
obj <- { value: _ } <$> getValue
print obj.value
logShow obj.value
let x = 1.0
point <- { x: _, y: x } <$> return 2.0
point <- { x: _, y: x } <$> pure 2.0
assert $ point.x == 2.0
assert $ point.y == 1.0
log (mkRecord 1.0 "Done!").bar
41 changes: 20 additions & 21 deletions examples/passing/OperatorInlining.purs
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,41 @@ import Control.Monad.Eff.Console
main = do

-- semiringNumber
print (1.0 + 2.0)
print (1.0 * 2.0)
logShow (1.0 + 2.0)
logShow (1.0 * 2.0)

-- ringNumber
print (1.0 - 2.0)
print (negate 1.0)
logShow (1.0 - 2.0)
logShow (negate 1.0)

-- moduleSemiringNumber
print (1.0 / 2.0)
logShow (1.0 / 2.0)

-- ordNumber
print (1.0 > 2.0)
print (1.0 < 2.0)
print (1.0 <= 2.0)
print (1.0 >= 2.0)
print (1.0 == 2.0)
logShow (1.0 > 2.0)
logShow (1.0 < 2.0)
logShow (1.0 <= 2.0)
logShow (1.0 >= 2.0)
logShow (1.0 == 2.0)

-- eqNumber
print (1.0 == 2.0)
print (1.0 /= 2.0)
logShow (1.0 == 2.0)
logShow (1.0 /= 2.0)

-- eqString
print ("foo" == "bar")
print ("foo" /= "bar")
logShow ("foo" == "bar")
logShow ("foo" /= "bar")

-- eqBoolean
print (true == false)
print (true /= false)
logShow (true == false)
logShow (true /= false)

-- semigroupString
print ("foo" ++ "bar")
print ("foo" <> "bar")
logShow ("foo" <> "bar")

-- latticeBoolean
print (top && true)
print (bottom || false)
logShow (top && true)
logShow (bottom || false)

-- complementedLatticeBoolean
print (not true)
logShow (not true)
Loading