While doing convertion of Strings to Text, relude is tempting me #889
Replies: 4 comments 5 replies
-
Is this stuff going to work with GHCJS? I am very skeptical of batteries-included preludes for being antithetical to a fine-grained library ecosystem emphasizing "depend on only what you use" and maximizing portability. Batteries-included design in fundamentally non-compositional as not everything can include all the goodies because some things need to be used to define the goodies, and making an artificial "below the nice stuff, above the nice stuff" split is needlessly frictive. |
Beta Was this translation helpful? Give feedback.
-
There is a bunch of discussion over in https://discourse.haskell.org/ about overhauling base, prelude, etc. I strongly encourage waiting for that stuff to settle over the next year or so. |
Beta Was this translation helpful? Give feedback.
-
I think we can go with relude, and roll back it we ever need it. HNix is a big piece of software, and depends on many things. A custom prelude is not much more compared on all our dependencies at the moment. I guess we may rely more and more on it, but that is fine with me. |
Beta Was this translation helpful? Give feedback.
-
Would note that text datatype conversion map is: https://hackage.haskell.org/package/relude-1.0.0.1/docs/Relude-String.html The But Would migrate to |
Beta Was this translation helpful? Give feedback.
-
Because
text
managed not to ship theshow
analog (tshow
).And that is why now during migration instead of
show
now I need to doText.pack (show a)
just to have type cast. And code would need to do the marshaling. Or we would receive more of weird go-around-old-bugs dependencies and imports.There is a number of preludes, people used to recommend switching to the most drop-in basic
basic-prelude
, but there were things like: snoyberg/basic-prelude#67.At least,
tshow
is there now.But the more I think about it - the more I want to go to the clean polished solution, that is to the
relude
.relude
is seen as "new" prelude, but it is in fact is one of the plder preludes that had "a do-over again properly" anew several times.It is a well-known
protolude
developed by Stephen Diehl.Then
Serokell
tookprotolude
and forked & reimplemented it for internal production use, the result isuniversum
.In 2017 the RIO prelude was released.
Then the main developer of toolin in Serokell, one that migrated
protolude
and created & maintaineduniversum
created own companykowainik
Then
kowainik
took theuniversum
and again, forked it and reimplemented the prelude the 3-rd time, into therelude
.Kowainik
overall produced a number of high-quality tooling: GitHub profile Main page, which have pretty wide use.Their quality of the processes, the code is high, and the level of documentation to the projects is unprecedented.
Particularly the
relude
documentation is what is called "full documentation": For example random module:Lifted.Concurrent
orLifted.IORef
Snoyman is known to be opinionated, and RIO is of course came-out pretty opinionated, which can be observed that creator of prelude starts to "recommend" a long list of extensions for people to "use with the prelude", and then apologizes that some of them are unsafe and controversial. And Snoyman himself maintains the RIO, and we know how many things he juggles. I have some reports opened that are still waiting for him after a year or more.
Vince of the
foundation
is also very opinionated, and became unresponsive these days (a year or more), which created difficulties that were mentioned in a neighbor project Support GHC 9.0.1 (at least in some packages) dhall-lang/dhall-haskell#2154 (comment).Dima (I need to be honest, I happen to know him personally, so the nepotia can be involved here) - he had a years-long process of developing the tooling inside Serokell, then as Kowainik, and he is only one of several people that had the ability to do-over the several redos of the prelude, and maintain them afterward. At the time of working with him I known Dima as very humble and chill person, in the social psychology storm that was Serokell, he was calm water, he is a very pleasant to do work with & balanced guy that devoted his life to building useful Haskell tooling.
And so the 4-th generation of the lean prelude came-out very well. And when I do String <-> Text conversions in HNix, I know that the question of
Text
,Bytestring
andString
is fully solved there,show
is polymorphic over the return type requested, main use is Text, Bytestring is provided, String is optional. For example, a lot of the things we have inUtils
are in therelude
.And the Prelude dependency graph includes only what newly done prelude should include and nothing more:
dependency graph
Solved text data type question and solved list question, and safe versions of functions with them, some basic data containers, some basic GHC features as Nats, MTL and that is all.
That is what packed into the prelude. And those dependencies can be reduced from the imports, so no longer importing
Data.Bool ( bool ), Data.Text Text, Data.Text as Text, Data.Maybe (fromMaybe), Control.Applicative (*>), Data.Functor ($>), Control.Monad (<=<)
and so on and so on - all those basics are thought about many years ago inprotolude
and was polished afterwards.Since I what to migrate the project from String to Text, and from List to NonEmpty List - it is much cleaner to do the migration to the
relude
that does prelude properly.show
anyway already had type class overhead, so why not use it for its purpose, let type class polymorphism do its work, it would save 100 fold by freeing from the data marshaling.They were in the "beta" for ~2.5 years (again, it is after it was stabilized as Protolude, then as Universum, now as Relude), and now they recently proclaimed final stabilization by naming it the
1.0.0.0
.I recommend to check-out the further description in the: https://github.com/kowainik/relude, because reading more deeply into it I found that what I did recently in HNix - a number of those things were already in the Relude. And many of functions form our
Utils
are there, so we can reduce and kind-of stop building our own internal analog for prelude. As also there are the Bool <-> Maybe <-> Either casts, which I frequently want to use, functions to work with tuples (first
,second
,both
), and other such basic stuff.For me it is easier to migrate to
relude
with provided by them guardrails for migration once, than to anyway migrate String to Text, but by importing and qualifying and do marshaling back'n'forth the types (which defeats the purpose of doing String -> Text in default Prelude, if to not ship a lot of deps and more imports into every module) and then to do circles around grooming all that and further beyond to the flaws of the Prelude and core packages just to preserve all of the old bugs because they are well-known. Better simply relax and know thatrelude
figured-out proper prelude after going through 4 generations of making prelude, and then ask to relax the incoming people.As an additional effect, it would clean-up our code even more and would increase the quality and readability of the code we have in the project.
Beta Was this translation helpful? Give feedback.
All reactions