Skip to content

add Enum instance for Char, fix all versions#3

Merged
paf31 merged 1 commit into
purescript:masterfrom
jdegoes:ready/char-instance
Oct 16, 2014
Merged

add Enum instance for Char, fix all versions#3
paf31 merged 1 commit into
purescript:masterfrom
jdegoes:ready/char-instance

Conversation

@jdegoes

@jdegoes jdegoes commented Oct 16, 2014

Copy link
Copy Markdown
Contributor

This is fully backward compatible, albeit with one caveat: it adds a dependency on the latest version of purescript-strings, so could potentially introduce a conflict if released under a patch fix update (albeit, only in the case a user of the library is not compatible with the latest purescript-strings and has opted not to fix patch version for their dependency on purescript-enums).

The current version is 0.2.1, so this could be 0.2.2 under a patch fix update, or 0.3.0 otherwise.

@paf31

paf31 commented Oct 16, 2014

Copy link
Copy Markdown
Contributor

Wouldn't it be better to put this in strings?

@paf31

paf31 commented Oct 16, 2014

Copy link
Copy Markdown
Contributor

Code looks good though.

@jdegoes

jdegoes commented Oct 16, 2014

Copy link
Copy Markdown
Contributor Author

It depends on which one you thing is more "core", right? If we added character literals at some point (e.g. 'A'), then that data type would go in Prelude, so the instance would go here and the dependency on strings dropped. That's why I added it here: I view 'Data.Char' as being more "core" than Data.Enum.

Indeed, many more projects import purescript-strings that import purescript-enums. So if we swap the dependency, then anyone who pulls in strings will also get enums.

Still, happy to switch it, the above was just my reasoning at the time. Let me know.

@paf31

paf31 commented Oct 16, 2014

Copy link
Copy Markdown
Contributor

I guess I was thinking of quickcheck where class modules depend on instance modules.

@jdegoes

jdegoes commented Oct 16, 2014

Copy link
Copy Markdown
Contributor Author

In Quickcheck, the class Arbitrary is implemented for all core types (Char, Number, String, etc.). In a similar fashion, in Enums, the class Enu�m is implemented for all core types which are Enums (Tuple, Char, Boolean, etc.). Right?

@paf31

paf31 commented Oct 16, 2014

Copy link
Copy Markdown
Contributor

Yes, that makes sense.

paf31 added a commit that referenced this pull request Oct 16, 2014
add Enum instance for Char, fix all versions
@paf31 paf31 merged commit d28e6fc into purescript:master Oct 16, 2014
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.

2 participants