Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump pretty-show to 1.10 which supports quasi-quotes #365

Merged
merged 1 commit into from
Jan 31, 2020

Conversation

jacobstanley
Copy link
Member

I have bumped the bounds and updated the hedgehog-example:

       ┏━━ hedgehog-example/src/Test/Example/QuasiShow.hs ━━━
    35 ┃ prop_foo :: Property
    36 ┃ prop_foo =
    37 ┃   property $ do
    38 ┃     x <- forAll (SomeData <$> genFoo <*> genFoo)
       ┃     │ SomeData { someFoo1 = [foo|kick|] , someFoo2 = [foo|kick|] }
    39 ┃     x === SomeData (Foo "quasi") (Foo "quoted")
       ┃     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       ┃     │ ━━━ Failed (- lhs) (+ rhs) ━━━
       ┃     │ - SomeData { someFoo1 = [foo|kick|] , someFoo2 = [foo|kick|] }
       ┃     │ + SomeData { someFoo1 = [foo|quasi|] , someFoo2 = [foo|quoted|] }

I updated the bounds on Hackage for hedgehog-1.0.2 already.

This will be particularly useful for types like dates and times which have a sensible human readable representation.

By changing the Show instance to render with quasi-quotes you can stay within the unwritten rule that Show should be valid Haskell syntax to construct the value, while still having something which is very compact.

For example:

[time|2000-01-01T10:00:00|]

vs

DateTime { datetimeDate = Date { dateYear = Year { getYear = 2000 }, ... etc

The means you should be able to both read counterexamples easily and also paste them into your code for experimentation.

Related: yav/pretty-show#40

@jacobstanley jacobstanley changed the title Bump pretty-show to 1.10 one which supports quasi-quotes Bump pretty-show to 1.10 which supports quasi-quotes Jan 30, 2020
@jacobstanley jacobstanley merged commit f90ac6f into hedgehogqa:master Jan 31, 2020
@jacobstanley jacobstanley deleted the pretty-show branch January 31, 2020 00:35
@moodmosaic
Copy link
Member

🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants