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

Add Relude.Extra.Tuple module with useful utilities #92

Closed
chshersh opened this issue Oct 5, 2018 · 2 comments · Fixed by #93
Closed

Add Relude.Extra.Tuple module with useful utilities #92

chshersh opened this issue Oct 5, 2018 · 2 comments · Fixed by #93
Labels
extra Relude.Extra Hacktoberfest https://hacktoberfest.digitalocean.com/

Comments

@chshersh
Copy link
Contributor

chshersh commented Oct 5, 2018

The following functions might be useful sometimes:

dupe    :: a -> (a, a)
fstWith :: (a -> b) -> a -> (a, b)
sndWith :: (a -> b) -> a -> (b, a)
mapBoth :: (a -> b) -> (a, a) -> (b, b)
@chshersh chshersh added Hacktoberfest https://hacktoberfest.digitalocean.com/ extra Relude.Extra labels Oct 5, 2018
@cronokirby
Copy link
Collaborator

Instead of fstWith and sndWith maybe mapSnd and mapFst where they denote where the mapped value goes. These names also coincide better with mapBoth

@chshersh
Copy link
Contributor Author

chshersh commented Oct 5, 2018

I don't like mapSnd and mapFst names because for these functions I expect types to be:

mapFst :: (a -> b) -> (a, c) -> (b, c)
mapSnd :: (a -> b) -> (c, a) -> (c, b)

The idea is to return the element itself with the result of the mapped value.

chshersh pushed a commit that referenced this issue Oct 6, 2018
* adds an asumMap function to Foldable

* [#81] updates CHANGELOG.md to reflect asumMap addition

* [#81] Simplifes asumMap, adding an inline pragma, and bumps the package version to 0.3.1

* [#81] Removes a line of whitespace on CHANGELOG to keep formatting consistent

* [#86] adds Hlint rules for 'asumMap'

* updates .hlint.yaml file and fixes hlint.dhall syntax

* [#86] Avoids composition in asumMap hlint rules to play nicer with hlint

* [#86] adds both point free and pointful rules for asumMap in hlint, and updates yaml

* [#86] fixes the first asumMap rule

* [#89] adds Relude.Extra.Type module, containing a typeName function

* updates changelog

* [#89] Formatting: adds line of separation between Relude and other module imports

* [#89] Makes typeName inlineable and have 2 implementations to support ghc 8.0

* [#89] Updates Relude module documentation to talk about Relude.Extra.Type

* Readds accidentally deleted line of documentation [ci skip]

* Simplifies documentation example for typeName [ci skip]

* fixes parentheses in documentation for typeName

* [#92] Adds a Relude.Extra.Tuple module with a 'dupe' function

* [#92] Adds 'mapToFst' and 'mapToSnd' to Extra.Tuple

* [#92] Adds a mapBoth function

* [#92] Inlines everything in Relude.Extra.Tuple

* Updates changelog

* Updates documentation in Relude module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extra Relude.Extra Hacktoberfest https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants