[#227] Create Relude.Extra module#236
Conversation
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
Co-Authored-By: hint-man[bot] <44720633+hint-man[bot]@users.noreply.github.com>
chshersh
left a comment
There was a problem hiding this comment.
@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.
src/Relude/Extra/Bifunctor.hs
Outdated
| import Relude.Functor (Bifunctor, Functor, second, fmap, first) | ||
| import Relude.Function ((.)) | ||
| import Relude.Extra.Validation (bimap) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Relude.Extra moduleRelude.Extra module
e036ac6 to
bdf8e7d
Compare
|
If anything is alright, could someone help me with the open checkboxes of the PR template, do I need to do anything specific? :) |
vrom911
left a comment
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Some extra white spaces are added accidentally, I guess.
src/Relude.hs
Outdated
|
|
||
| {- $extra | ||
| __"Relude.Extra"__ contains reexports from "Relude.Extra". | ||
| -} |
There was a problem hiding this comment.
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 ⬆️
src/Relude/Extra/Enum.hs
Outdated
|
|
||
| import Relude | ||
| import Relude.Extra.Tuple (mapToFst) | ||
| import Relude.Extra.Tuple |
There was a problem hiding this comment.
It's okau to leave explicit list of imports for extra modules 🙂
|
|
||
| import Relude | ||
|
|
||
|
|
There was a problem hiding this comment.
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]. | ||
|
|
There was a problem hiding this comment.
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))
|
Thanks @vrom911 I've adjusted the code to your mentioned changes and hope everything is fine now. If not, please let me know. |
chshersh
left a comment
There was a problem hiding this comment.
Thanks @mstruebing, looks nice!
vrom911
left a comment
There was a problem hiding this comment.
Yes, looks nice! Thank you again, @mstruebing 👍
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:
or
Resolves #227
Checklist:
HLint
hlint.dhallaccordingly to my changes (add new rules for the new imports, remove old ones, when they are outdated, etc.)..hlint.yamlfile (see this instructions).General
stylish-haskellfile.[ci skip]text to the docs-only related commit's name.