Reorganize Standard Library #6546
Replies: 9 comments 2 replies
-
We might want to consider prefixing the whole standard library with |
Beta Was this translation helpful? Give feedback.
-
Sounds like it should be called |
Beta Was this translation helpful? Give feedback.
-
I think Matthew's suggestion to have a top level namespace is a good one - for me it's something that Java got right and Haskell got wrong. Maybe |
Beta Was this translation helpful? Give feedback.
-
A benefit of using modules is also that dependencies between modules would become much more clear. |
Beta Was this translation helpful? Give feedback.
-
@mlutze @JonathanStarup Do either of you have a screenshot of our sorting exercise? I cannot find my pictures. |
Beta Was this translation helpful? Give feedback.
-
I would like to get started on this slowly. I plan to make a series of small issues to refactor very gradually. (Just because I make an issue does not mean its settled. We can still discuss in that issue.) @stephentetley Would you be interested in helping out? I ask because you invested a lot in the standard library. |
Beta Was this translation helpful? Give feedback.
-
Thanks Magnus, yes I'll be interested in helping out. I'd got a bit stuck with effects not being ready and I had to get up to speed with Python for work, but now effects are coming online I'll be prioritizing Flix again. |
Beta Was this translation helpful? Give feedback.
-
About adding Range into the library. Could we add as usual in Range module or in Data.Range one? |
Beta Was this translation helpful? Give feedback.
-
I think Data.Range |
Beta Was this translation helpful? Give feedback.
-
I would like to open a discussion on reorganization of the standard library. While the current structure has served us well, I think we cannot keep putting everything into the root module. We should try to break it down.
I do not plan to make any changes before "qualified uses" are supported (i.e. #6515). Thus if module
X
is moved toY.Z.W
a qualified use ofY.Z.W.X
will restore current functionality. Moreover, we will designate a collection of default qualified uses. For example,List
should always be available imho.The current library is here: https://api.flix.dev/
We should look for inspiration among Haskell, Rust, Scala cats, etc.
With that, here is a proposal to get started.
Default Qualified Uses:
We should try to give each root module some meaning. Here is an attempt:
Algebra
contains mathematical abstractions (e.g.Monoid
).Core
modules somehow essential to the language.Core.Ops
type classes for+
,-
and so forth.Data
contains collections and collection-like modules.System
contains things for the platform and things likely to have theIO
effect.Util
contains "mini-library" modules.We should also come up with some rules like
Util
can depend on everything, butCore
should not depend onUtil
.Beta Was this translation helpful? Give feedback.
All reactions