purescript-contrib / purescript-quickcheck-laws

QuickCheck powered law tests for PureScript's core typeclasses.
MIT License
25 stars 18 forks source link

0.9.1 Compatibility #11

Closed bkonkle closed 8 years ago

bkonkle commented 8 years ago

I tried to dig in and find out why this isn't working in 0.9.1, but I don't understand what's going wrong. Here's the build output:

* Building project in /Users/brandon/code/purescript-quickcheck-laws
[1/3 ErrorParsingModule] src/Test/QuickCheck/Laws/Control/Applicative.purs:44:50

  44      interchange y u = (u <*> pure y) == (pure ($ y) <*> u)

  Unable to parse module:
  unexpected "y"
  expecting )

[2/3 ErrorParsingModule] src/Test/QuickCheck/Laws/Control/Extend.purs:24:32

  24    associativity f g x = ((f <<=) <<< (g <<=) $ x) == (f <<< (g <<=) <<= x)

  Unable to parse module:
  unexpected )
  expecting expression

[3/3 ErrorParsingModule] src/Test/QuickCheck/Laws/Data/Functor.purs:30:54

  30    composition f g x = ((<$>) (f <<< g) x) == (((f <$>) <<< (g <$>)) x)

  Unable to parse module:
  unexpected )
  expecting expression

           Src   Lib   All
Warnings   0     0     0
Errors     3     0     3

It looks like the compiler believes there are mismatched parentheses, but I can't find them.

garyb commented 8 years ago

It's due to the change in operator sections:

-- this:
interchange y u = (u <*> pure y) == (pure ($ y) <*> u)

-- needs to become:
interchange y u = (u <*> pure y) == (pure (_ $ y) <*> u)

-- from:
associativity f g x = ((f <<=) <<< (g <<=) $ x) == (f <<< (g <<=) <<= x)

-- to:
associativity f g x = ((f <<= _) <<< (g <<= _) $ x) == (f <<< (g <<= _) <<= x)

-- from:
composition f g x = ((<$>) (f <<< g) x) == (((f <$>) <<< (g <$>)) x)

-- to:
composition f g x = ((<$>) (f <<< g) x) == (((f <$> _) <<< (g <$> _)) x)

Basically the (× a) and (a ×) form of operator section no longer exist, and now require an underscore placeholder. The change was to make unary negation unambiguous.

garyb commented 8 years ago

Looks like @menelaos beat you to it: #12! Thanks for taking a look though.