Skip to content

Commit cf683a8

Browse files
committed
Merge pull request #50 from telser/purescript-0.8-warnings
Fix warnings generated by purescript-0.8.0
2 parents 8edf244 + 2e47466 commit cf683a8

File tree

6 files changed

+35
-29
lines changed

6 files changed

+35
-29
lines changed

src/Test/QuickCheck.purs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717
-- | ```
1818
module Test.QuickCheck where
1919

20-
import Prelude
20+
import Prelude (class Show, class Eq, Unit, show, (++), (/=), (==), (<<<), (>>=), return, ($), one, bind, (+), zero, unit)
2121

2222
import Control.Monad.Eff (Eff())
2323
import Control.Monad.Eff.Console (CONSOLE(), log)
2424
import Control.Monad.Eff.Exception (EXCEPTION(), throwException, error)
2525
import Control.Monad.Eff.Random (RANDOM())
2626
import Data.List (List(..), replicateM)
27-
import Test.QuickCheck.Arbitrary
28-
import Test.QuickCheck.Gen
29-
import Test.QuickCheck.LCG
27+
import Test.QuickCheck.Arbitrary (class Arbitrary, arbitrary)
28+
import Test.QuickCheck.Gen (Gen, evalGen)
29+
import Test.QuickCheck.LCG (Seed, randomSeed)
3030

3131
-- | A type synonym which represents the effects used by the `quickCheck` function.
3232
type QC eff a = Eff (console :: CONSOLE, random :: RANDOM, err :: EXCEPTION | eff) a
@@ -100,14 +100,20 @@ instance showResult :: Show Result where
100100
-- | ```purescript
101101
-- | test x = myProperty x <?> ("myProperty did not hold for " <> show x)
102102
-- | ```
103-
(<?>) :: Boolean -> String -> Result
104-
(<?>) true _ = Success
105-
(<?>) false msg = Failed msg
103+
withHelp :: Boolean -> String -> Result
104+
withHelp true _ = Success
105+
withHelp false msg = Failed msg
106+
107+
infix 2 withHelp as <?>
106108

107109
-- | Self-documenting equality assertion
108-
(===) :: forall a. (Eq a, Show a) => a -> a -> Result
109-
(===) a b = a == b <?> show a ++ " /= " ++ show b
110+
assertEquals :: forall a. (Eq a, Show a) => a -> a -> Result
111+
assertEquals a b = a == b <?> show a ++ " /= " ++ show b
112+
113+
infix 2 assertEquals as ===
110114

111115
-- | Self-documenting inequality assertion
112-
(/==) :: forall a. (Eq a, Show a) => a -> a -> Result
113-
(/==) a b = a /= b <?> show a ++ " == " ++ show b
116+
assertNotEquals :: forall a. (Eq a, Show a) => a -> a -> Result
117+
assertNotEquals a b = a /= b <?> show a ++ " == " ++ show b
118+
119+
infix 2 assertNotEquals as /==

src/Test/QuickCheck/Arbitrary.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module Test.QuickCheck.Arbitrary where
22

3-
import Prelude
3+
import Prelude (Unit, Ordering(GT, EQ, LT), const, (<<<), pure, (>>=), (<$>), id, flip, zero, bind, (>>>), (<*>), map, unit, return, ($), negate, (*), (<))
44

55
import Data.Char (toCharCode, fromCharCode)
66
import Data.Either (Either(..))
@@ -12,7 +12,7 @@ import Data.List (List())
1212
import Data.Maybe (Maybe(..))
1313
import Data.String (charCodeAt, fromCharArray, split)
1414
import Data.Tuple (Tuple(..))
15-
import Test.QuickCheck.Gen
15+
import Test.QuickCheck.Gen (Gen, listOf, chooseInt, sized, perturbGen, repeatable, arrayOf, oneOf, uniform)
1616

1717
-- | The `Arbitrary` class represents those types whose values can be
1818
-- | _randomly-generated_.

src/Test/QuickCheck/Data/AlphaNumString.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module Test.QuickCheck.Data.AlphaNumString where
22

3-
import Prelude
3+
import Prelude ((<$>), (<<<), pure, map)
44

55
import Data.String (fromCharArray, toCharArray)
6-
import Test.QuickCheck.Gen
7-
import Test.QuickCheck.Arbitrary
6+
import Test.QuickCheck.Gen (Gen, arrayOf, oneOf)
7+
import Test.QuickCheck.Arbitrary (class Coarbitrary, class Arbitrary, coarbitrary)
88

99
-- | A newtype for `String` whose `Arbitrary` instance generated random
1010
-- | alphanumeric strings.

src/Test/QuickCheck/Data/ApproxNumber.purs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
module Test.QuickCheck.Data.ApproxNumber where
22

3-
import Prelude
3+
import Prelude (class Num, class DivisionRing, class Ring, class ModuloSemiring, class Semiring, class Ord, class Eq, (-), mod, (/), one, (*), zero, (+), compare, (<$>), negate, (>=), (&&), (<=))
44

5-
import Test.QuickCheck.Arbitrary
5+
import Test.QuickCheck.Arbitrary (class Coarbitrary, class Arbitrary, coarbitrary, arbitrary)
66

77
-- | A newtype for `Number` whose `Eq` instance uses an epsilon value to allow
88
-- | for precision erros when comparing.
99
newtype ApproxNumber = ApproxNumber Number
1010

1111
-- Approximate equality comparison
12-
(=~=) :: Number -> Number -> Boolean
13-
(=~=) x y = (y - x) <= epsilon && (y - x) >= (-epsilon)
12+
approximateEqual :: Number -> Number -> Boolean
13+
approximateEqual x y = (y - x) <= epsilon && (y - x) >= (-epsilon)
1414
where
1515
epsilon = 0.00000001
1616

17+
infix 2 approximateEqual as =~=
18+
1719
instance arbitraryApproxNumber :: Arbitrary ApproxNumber where
1820
arbitrary = ApproxNumber <$> arbitrary
1921

src/Test/QuickCheck/Gen.purs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,24 @@ module Test.QuickCheck.Gen
2727
, randomSample'
2828
) where
2929

30-
import Prelude
30+
import Prelude (bind, (/), (<$>), return, ($), one, (-), zero, (==), pure, (<#>), (<=), (<<<), map, (<), (+), otherwise, (>=), mod, (*), (>>>))
3131

3232
import Control.Monad.Eff (Eff())
3333
import Control.Monad.Eff.Random (RANDOM())
3434
import Control.Monad.State (State(), runState, evalState)
3535
import Control.Monad.State.Class (state, modify)
36-
import Control.Monad.Rec.Class (MonadRec, tailRecM)
37-
import Math ((%))
36+
import Control.Monad.Rec.Class (class MonadRec, tailRecM)
3837
import Data.Array ((!!), length)
3938
import Data.Tuple (Tuple(..))
4039
import Data.Foldable (fold)
41-
import Data.Int (toNumber, fromNumber)
40+
import Data.Int (toNumber)
4241
import Data.Maybe (fromMaybe)
43-
import Data.Maybe.Unsafe as U
4442
import Data.Monoid.Additive (Additive(..), runAdditive)
4543
import Data.Tuple (Tuple(..), fst, snd)
4644
import Data.Either (Either(..))
4745
import Data.List (List(..), fromList)
48-
import Test.QuickCheck.LCG
49-
import qualified Math as M
46+
import Test.QuickCheck.LCG (Seed, lcgPerturb, lcgN, lcgNext, runSeed, randomSeed)
47+
import Math as M
5048

5149
-- | Tests are parameterized by the `Size` of the randomly-generated data,
5250
-- | the meaning of which depends on the particular generator used.

src/Test/QuickCheck/LCG.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ module Test.QuickCheck.LCG
1010
, randomSeed
1111
) where
1212

13-
import Prelude
13+
import Prelude (class Eq, class Show, eq, show, (<>), mod, (+), (-), (<$>), (<<<), (*), ($))
1414

1515
import Math ((%))
1616
import Control.Monad.Eff (Eff())
1717
import Control.Monad.Eff.Random (RANDOM(), randomInt)
1818
import Data.Int (fromNumber, toNumber)
19-
import qualified Data.Maybe.Unsafe as U
19+
import Data.Maybe.Unsafe as U
2020

2121
-- | The *multiplier*: a magic constant for the linear congruential generator
2222
lcgM :: Int

0 commit comments

Comments
 (0)