Skip to content

Updates for psc 0.7 #6

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

Merged
merged 8 commits into from
Apr 30, 2015
Merged

Updates for psc 0.7 #6

merged 8 commits into from
Apr 30, 2015

Conversation

hdgarrood
Copy link
Contributor

I still need to test the ordArray instance, it's not immediately clear how to do that (since if you try to install purescript-console, you get another version of purescript-prelude in your bower_components...)

}
}
}
""" :: forall a. (a -> a -> (Ordering -> Unit) -> Unit) -> Ordering -> Array a -> Array a -> Ordering
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran into the same issues when I tried to implement this. I landed on using Int as the return type (-1, 0, 1), which isn't ideal, but I think it's better than paying the price of four extra function arguments. I'd also rather avoid the impure callback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the version in tests/prelude.purs in the compiler repo. It uses Number, but you get the gist.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the extra arguments be simpler? That doesn't impose any cost on using the function as they're curried in at instance-definition-time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that's true. I maintain my stance on the impure bit though :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! I'm playing around with an alternative implementation now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bug in the prelude version by the way, both inner functions accept ys.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also i is never incremented!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops :) I guess it's not used then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

D'oh. I actually put it in there to make things compile, then forgot about it. I meant to go back and fix it up.

@hdgarrood
Copy link
Contributor Author

The ordArray instance is broken - compare [] [0] gives EQ. I'm working on tests now.

@paf31
Copy link
Contributor

paf31 commented Apr 30, 2015

Looks nice thanks. For the testing, I usually delete the extra Prelude from bower_components. I was thinking we would add a separate directory with its own bower.json for tests anyway.

@hdgarrood
Copy link
Contributor Author

There's a new ordArray instance in here now, which seems to work. It's based on the one in the compiler currently.

You can run the tests by doing:

$ psc test/Main.purs src/**/*.purs bower_components/*/src/**/*.purs --main | node

I'm not good enough with gulp to work out how to make this into gulp test.

@garyb
Copy link
Member

garyb commented Apr 30, 2015

I did something similar in purescript-arrays: https://github.com/purescript/purescript-arrays/blob/master/gulpfile.js#L44-L49

@paf31
Copy link
Contributor

paf31 commented Apr 30, 2015

Looks good to me. I was thinking that for tests, we could eventually work on a separate test suite project for each core library. We could even use quickcheck that way.

@garyb Looks good, merge?

@garyb
Copy link
Member

garyb commented Apr 30, 2015

Maybe we should break out a purescript-assert or something that provides zero-dependency assertions so we can use it across any of the projects above quickcheck in the dependency hierarchy.

@garyb
Copy link
Member

garyb commented Apr 30, 2015

Yep, :shipit:

@paf31
Copy link
Contributor

paf31 commented Apr 30, 2015

👍 for purescript-assert, but not for the reason you said necessarily. I would rather have the option of using quickcheck, but separate the project out so we don't get circular dependencies.

paf31 added a commit that referenced this pull request Apr 30, 2015
@paf31 paf31 merged commit 62660c4 into purescript:master Apr 30, 2015
@garyb
Copy link
Member

garyb commented Apr 30, 2015

My only concern about that is the thing we have with the core-tests library currently - nobody knows it exists, and we don't check those tests when making updates or add new cases for new features. That's not unfixable, we just have to make sure whatever it is is integrated into the travis build for the corresponding libraries.

JordanMartinez added a commit that referenced this pull request Dec 24, 2020
* first commit

* Fix instances for record fields

* Break modules up

* Deriving Show (#5)

* Initial work on deriving Show

* Add test for Show

* Remove import

* Travis etc.

* Data.Generic.Rep.Bounded (#6)

* Data.Generic.Rep.Bounded

Generic implementations of Prelude.Bounded class's top and bottom.

* GenericBounded - don't support product types

* GenericBounded - only support NoArguments

* Update for PureScript 0.11

* Add Generic instance for Maybe (#9)

* Add missing Bounded instances for Argument

* Add GenericEnum and GenericBoundedEnum

* Add enum tests, convert existing "tests" into assertions

* Product instances in Bounded and Enum

* Added GenericShowFields instances for NoConstructors and NoArguments (#20)

* Added Eq and Show instances to NoArguments and NoConstructors

* Added GenericShowFields

* Removed Show, Eq

* Cleanup

* Removed NoConstructors Show instance

* Remove Rec and Field & update package & bower symbols

* Bump deps for compiler/0.12

* Remove symbols and fix operator fixity issue

* Update dependencies, license

* Added HeytingAlgebra, Semiring, Ring

* Fix type annotation precedence in tests

* Replace monomorphic proxies by Type.Proxy.Proxy (#44)

* Remove Generic Maybe instance

* Remove Generic Enum from src and test

* Move all files to their correct folders and rename files to Generic.purs

* Update module names to match their file names

* Move test file for Data.Generic.Rep into proper folder and rename

* Update generic-rep test file module to match file path

* Rename generic-rep test name to testGenericRep

* Replace generic Show's  Foldable.intercalate usage with FFI

* Replace Tuple with Pair in Data.Generic.Rep tests

* Remove Maybe import from Data.Generic.Rep test file

* Remove Maybe import from Data.Generic.Rep

* Extract AlmostEff and assert to Test.Utils.purs file

* Update Data.Generic.Rep tests to use AlmostEff; include it in main tests

* Import implies in Data.Generic.Rep tests

Co-authored-by: Phil Freeman <[email protected]>
Co-authored-by: Matthew Leon <[email protected]>
Co-authored-by: Gary Burgess <[email protected]>
Co-authored-by: Liam Goodacre <[email protected]>
Co-authored-by: Jorge Acereda <[email protected]>
Co-authored-by: Kristoffer Josefsson <[email protected]>
Co-authored-by: Denis Stoyanov <[email protected]>
Co-authored-by: Harry Garrood <[email protected]>
Co-authored-by: Cyril <[email protected]>
turlando referenced this pull request in purescm/purescript-prelude Sep 3, 2021
* first commit

* Fix instances for record fields

* Break modules up

* Deriving Show (#5)

* Initial work on deriving Show

* Add test for Show

* Remove import

* Travis etc.

* Data.Generic.Rep.Bounded (#6)

* Data.Generic.Rep.Bounded

Generic implementations of Prelude.Bounded class's top and bottom.

* GenericBounded - don't support product types

* GenericBounded - only support NoArguments

* Update for PureScript 0.11

* Add Generic instance for Maybe (purescript#9)

* Add missing Bounded instances for Argument

* Add GenericEnum and GenericBoundedEnum

* Add enum tests, convert existing "tests" into assertions

* Product instances in Bounded and Enum

* Added GenericShowFields instances for NoConstructors and NoArguments (purescript#20)

* Added Eq and Show instances to NoArguments and NoConstructors

* Added GenericShowFields

* Removed Show, Eq

* Cleanup

* Removed NoConstructors Show instance

* Remove Rec and Field & update package & bower symbols

* Bump deps for compiler/0.12

* Remove symbols and fix operator fixity issue

* Update dependencies, license

* Added HeytingAlgebra, Semiring, Ring

* Fix type annotation precedence in tests

* Replace monomorphic proxies by Type.Proxy.Proxy (purescript#44)

* Remove Generic Maybe instance

* Remove Generic Enum from src and test

* Move all files to their correct folders and rename files to Generic.purs

* Update module names to match their file names

* Move test file for Data.Generic.Rep into proper folder and rename

* Update generic-rep test file module to match file path

* Rename generic-rep test name to testGenericRep

* Replace generic Show's  Foldable.intercalate usage with FFI

* Replace Tuple with Pair in Data.Generic.Rep tests

* Remove Maybe import from Data.Generic.Rep test file

* Remove Maybe import from Data.Generic.Rep

* Extract AlmostEff and assert to Test.Utils.purs file

* Update Data.Generic.Rep tests to use AlmostEff; include it in main tests

* Import implies in Data.Generic.Rep tests

Co-authored-by: Phil Freeman <[email protected]>
Co-authored-by: Matthew Leon <[email protected]>
Co-authored-by: Gary Burgess <[email protected]>
Co-authored-by: Liam Goodacre <[email protected]>
Co-authored-by: Jorge Acereda <[email protected]>
Co-authored-by: Kristoffer Josefsson <[email protected]>
Co-authored-by: Denis Stoyanov <[email protected]>
Co-authored-by: Harry Garrood <[email protected]>
Co-authored-by: Cyril <[email protected]>
turlando referenced this pull request in purescm/purescript-prelude Sep 4, 2021
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.

3 participants