Skip to content

[#227] Create Relude.Extra module#236

Merged
vrom911 merged 5 commits intokowainik:masterfrom
mstruebing:227/reludeExtra
Dec 19, 2019
Merged

[#227] Create Relude.Extra module#236
vrom911 merged 5 commits intokowainik:masterfrom
mstruebing:227/reludeExtra

Conversation

@mstruebing
Copy link
Copy Markdown
Contributor

@mstruebing mstruebing commented Dec 16, 2019

This is currently WIP as there are still errors while building.
Maybe someone can help me with that? I don't know how to fix these:

The class method signature for ‘...’ lacks an accompanying binding

or

‘...’ is not a (visible) method of class ‘...’

Resolves #227

Checklist:

HLint

  • I've changed the exposed interface (add new reexports, remove reexports, rename reexported things, etc.).
    • I've updated hlint.dhall accordingly to my changes (add new rules for the new imports, remove old ones, when they are outdated, etc.).
    • I've generated the new .hlint.yaml file (see this instructions).

General

  • I've updated the CHANGELOG with the short description of my latest changes.
  • All new and existing tests pass.
  • I keep the code style used in the files I've changed (see style-guide for more details).
  • I've used the stylish-haskell file.
  • My change requires the documentation updates.
    • I've updated the documentation accordingly.
  • I've added the [ci skip] text to the docs-only related commit's name.

This is currently WIP as there are still errors while building.
Maybe someone can help me with that? I don't know how to fix these:

```
The class method signature for ‘...’ lacks an accompanying binding
```

or

```
‘...’ is not a (visible) method of class ‘...’
```

closes kowainik#227
Copy link
Copy Markdown
Contributor

@hint-man hint-man bot left a comment

Choose a reason for hiding this comment

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

Do you know why your PR is still not approved? Because I chose not to approve it. But they will.

Co-Authored-By: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

@mstruebing Thanks for this refactoring! I believe we see compilation error because you wrote imports explicitly like this:

import Relude.Monoid (Monoid, Semigroup)

I guess the error should go if you write it like this (by exporting not only typeclasses but also their methods):

import Relude.Monoid (Monoid (..), Semigroup (..))

But I don't think that any of these should be neccessary. Implicit import Relude should work. You only need to add the Relude.Extra module to the .cabal file.

Comment on lines +28 to +30
import Relude.Functor (Bifunctor, Functor, second, fmap, first)
import Relude.Function ((.))
import Relude.Extra.Validation (bimap)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've been using implicit import Relude in extra modules because Relude doesn't reexport extra modules. So it's fine to save some time for us here and don't specify each module explicitly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's not as easy possible as there are many cycles - Relude imports Relude.Extra which imports Relude.Extra.X which imports Relude. I'll try :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

But Relude mustn't export Relude.Extra. And it currently doesn't do this:

The main motivation behind having Relude.Extra modules is that they are not exported by default from Relude.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you, now it is building and tests are running through.
I've needed to remove {-# LANGUAGE Safe #-} from Extra.hs otherwise I got errors:

src/Relude/Extra.hs:31:1: error:
    Relude.Extra.Group: Can't be safely imported!
    The module itself isn't safe.
   |
31 | import Relude.Extra.Group
   | ^^^^^^^^^^^^^^^^^^^^^^^^^

src/Relude/Extra.hs:33:1: error:
    Relude.Extra.Map: Can't be safely imported!
    The module itself isn't safe.
   |
33 | import Relude.Extra.Map

@mstruebing mstruebing changed the title WIP [#227] Create Relude.Extra module [#227] Create Relude.Extra module Dec 18, 2019
@mstruebing
Copy link
Copy Markdown
Contributor Author

If anything is alright, could someone help me with the open checkboxes of the PR template, do I need to do anything specific? :)

Copy link
Copy Markdown
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

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

Thanks for your work!

Regarding the leftover check-boxes: You don't need to do anything with HLint as you didn't added any main modules' functions. All other boxes are done 👍

src/Relude.hs Outdated
* __"Relude.Extra.Newtype"__: generic functions that automatically work for any
@newtype@.
* __"Relude.Extra.Tuple"__: functions for working with tuples.
* __"Relude.Extra.Type"__: functions for inspecting and working with types.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some extra white spaces are added accidentally, I guess.

src/Relude.hs Outdated

{- $extra
__"Relude.Extra"__ contains reexports from "Relude.Extra".
-}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This section is not used anywhere in Haddocks, so it won't be visible. Instead, you can add the link to Relude.Extra module with your short description right above the whole list of the extra modules ⬆️


import Relude
import Relude.Extra.Tuple (mapToFst)
import Relude.Extra.Tuple
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's okau to leave explicit list of imports for extra modules 🙂


import Relude


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We actually use 2 lines break after the imports section in our style guide


`relude` uses [PVP Versioning][1].
The changelog is available [on GitHub][2].

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for updating CHANGELOG!

We usually create the new section right above the latest release (if there is no any).

So you can add it like this on this line:

## Unreleased

* [#227](https://github.com/kowainik/relude/pull/236):
  Create `Relude.Extra` module
  (by [@mxstrbng](https://github.com/mstruebing))

@mstruebing
Copy link
Copy Markdown
Contributor Author

Thanks @vrom911 I've adjusted the code to your mentioned changes and hope everything is fine now. If not, please let me know.

Copy link
Copy Markdown
Contributor

@chshersh chshersh left a comment

Choose a reason for hiding this comment

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

Thanks @mstruebing, looks nice!

Copy link
Copy Markdown
Member

@vrom911 vrom911 left a comment

Choose a reason for hiding this comment

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

Yes, looks nice! Thank you again, @mstruebing 👍

@vrom911 vrom911 merged commit 02f95b3 into kowainik:master Dec 19, 2019
@chshersh chshersh added this to the v0.7.0.0: Refiner milestone Feb 25, 2020
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.

Create Relude.Extra module

3 participants