1. 23

I like the idea (gathering the most used packages into one) behind this package. I wonder how adoption will go; they did great with stack, maybe they will succeed again.

  1.  

  2. 4

    Aha, glad to see more people thinking of replacing prelude, especially Snoyman!

    The Foundation project aims towards the same goal, but I guess having a FP-complete backed alternative cannot hurt!

    [edit] Right, posted this comment too soon! This is a different approach, they plan to actually reuse the existing libraries. This is definitely nice, hopefully the prelude problem will definitely be fixed in 2~3 years from now.

    1. 3

      What “Prelude problem” ?

      1. 5

        The project README more or less states the problem:

        The RIO module works as a prelude replacement, providing more functionality and types out of the box than the standard prelude (such as common data types like ByteString and Text), as well as removing common “gotchas”, like partial functions and lazy I/O. The guiding principle here is:

        • If something is safe to use in general and has no expected naming conflicts, expose it from RIO
        • If something should not always be used, or has naming conflicts, expose it from another module in the RIO. hierarchy.

        Snoyman and FP-complete are trying to move Haskell more in the direction of a batteries-included solution for software development. The Haskell Foundation project mentioned by @NinjaTrappeur above is attempting the same thing.

        Many of the changes RIO makes as a Prelude replacement solve problems beginners don’t know they have until they’ve been coding a while in Haskell. Using String rather than Text or ByteString is one of the most common mistakes beginners make. And why shouldn’t they? It’s right there in the “base” of the language. And then you learn, often after months of coding, String performance is a disaster.

        Whether RIO is the right solution, time will tell. That it’s a step in the right direction, is beyond doubt.

        1. 5

          I personally use Protolude. The problems it solves (for my projects, on my computer, for my use cases) are:

          • head :: [a] -> a becomes head :: [a] -> Maybe a (and all the other partial functions that throw error "message", like tail and so on…)
          • everything is Text
          • convenience functions that I used to copy in all my project, for example: toS which convert from any string-like (Text, String, ByteString, …) to any other string-like.
          • foldl, head, … are on traversable not just lists
          • a lot of other stuff, that I’m missing at the top of my head
          1. 2

            afaik, it’s the issues connected with the standard prelude, either concerning inefficient data structures (String is defined as [Char], ie. a linked list) or simple lack of utilities, which are then afterwards commonly installed by many uses (eg. Data.Vector). Many other “alternative” preludes have tried to replace the standard, but most of them can’t manage to get any significant adoption.

            That’s at least what I understand when someone says “Prelude problem”.

            1. 2

              The Foundation README gives some information about this “problem”, RIO gives other arguments. The two main issues people have with Prelude is partial functions and Lazy IO, as fas as I can tell.

              1. 1

                @akpoff, @zge and @lthms pretty much summed up the problem.

                I would also come up with another problem class: “legacy semantics”.

                [EDIT] The following statement is wrong.

                The most notable offender is the Monad typeclass. As it is defined in base (prelude is re-exporting parts of the base library), Applicative is not a superclass of monad. Those two typeclasses are actually completely unrelated as it’s implemented. In other terms, you could end up with a Monad not being an Applicative. Some people are trying to fix that directly in base, some are trying to fix that in external libraries such as Foundation.

                In the end, it is not such of a big deal for an intermediate/experienced developer; however, it is quite confusing for newcomers. Not knowing what you can safely use from the standard library is not a really nice user experience in my opinion.

                [Edit] As a side note, I am saddened to see that the return keyword is preferred over pure. This keyword has a totally different meaning in procedural languages (ie. 90% of the languages), using it in this context is just a constant source of confusion for newcomers…

                1. 1

                  Applicative has been a superclass of Monad for quite some time in GHC base. I disagree with the change (breaks compatibility) but understand why they did it.

                  1. 1

                    Oh yes, you’re right, my bad!

                    See monoid and semigroup, the problem is quite similar.