Closed snoyberg closed 8 years ago
I have once found it useful to declare a MinLen of 2. I think the o prefix is still useful to avoid import conflicts and to give mono-traversable the chance to make differences with foldable and the opportunity to see different error messages.re-exporting without the prefix seems to work for classy-prelude
Actually, having a Prelude with both the Data.Foldable and Data.MonoTraversable identifiers all exported sounds like an interesting idea. OK, scratch the renaming thought.
Is there any objection then to other things I put in this list?
Sounds fine. I like the idea of MinLen as long as NonNull can still present its own interface and error messages
Alright, it took a while for me to free up time, but I've finally taken a stab at this. The work is on various various branches of different repos:
Unexpected outcomes:
Data.MonoTraversable.Unprefixed
with all of the identifiers from Data.MonoTraversable
, minus the o
prefix. ClassyPrelude
then imports that, meaning there's less code to maintain in ClassyPrelude
(making it easier to synchronize added identifiers)Monad
to Applicative
for GHC 7.10 and laterClassyPrelude
have moved into mono-traversable
. The basic idea is: I'd like to define as little in ClassyPrelude
itself as possibleThis addresses most of the points above. There are two questions that have come up for me which are worth exploring:
DList
instances to mono-traversable-instances
, though since that's a relatively cheap dependency I'm OK with moving it back if you'd preferData.Containers
module to be non-monomorphic. Unfortunately, I can't figure out a way to do that and get good unification between Set
s and Map
s. Possibilities:
Map
and Set
suffixes and don't have the same identifiers for the two data types. I'm overall -1 on this, as it breaks a lot of code and makes new code significantly uglierI have no particular time pressure on releasing these changes, so I'm fine with taking a bit more time if warranted.
Sounds great!
As long as documentation mentions mono-traversable-instances
it doesn't matter to me if stuff is moved there.
You should make all the changes you are confident in now and come back to Containers later.
This is merged to master, closing. Thanks for all the feedback :)
I'm not sure if I'm qualified to comment here, or if this is the right place to give feedback, but here's my experience as an application author (as against a library author).
I was exposed to ClassyPrelude via the Yesod scaffolding template and I was under the impression that it's just a saner version of the same old Prelude functions that I'm used to. That is, until I was hit with http://lpaste.net/178218 The error message made absolutely no sense to me, and for a moment I thought that ClassyPrelude had changed the core list ([]
) type to act funny.
I dug deeper into ClassyPrelude and discovered MonoTraversable. However, I found no mention of MinLen
in the MonoTraversable documentation. Digging even deeper made me realise that MinLen
was there in 0.10.2 (which is what the Yesod scaffolding template gives up to LTS 6.12). Finally, discovering the ChangeLog pointed me to this issue and made me realise that MinLen
was pretty much being deprecated.
Now, I'm in a fix. I'm on LTS-6.6 which is frozen (?) to v0.10.2 of MonoTraversable, which has defined regular functions like head
in terms of MinLen
, which is clearly not the way forward. However Data.NotNull
in that version is clearly marked as experimental.
I know that I'll have to bite the bullet and figure out how to get the latest version of ClassyPrelude and MonoTraversable to work with LTS-6.6. However, here are a bunch of related questions:
Data.NotNull
is the way forward, is it a good idea to replace the plain old list []
with the appropriate type from Data.NotNull
? Will it work with other libraries/functions that expect a regular list []
?Data.List.NonEmpty
and Data.NonNull
?
Now that mono-traversable has been in active use for a while, it's worth reviewing design points and seeing if we can do better. I've given some thought to the following points, and would appreciate feedback on them:
difference
in its full generality. I'd recommend consolidating on the jump-style abstraction, and then decide if we put that in jump, mono-traversable, or a separate package for container-like abstractions (containers-classes?)o
. I still think this makes sense for MonoFunctor and MonoTraversable, where the monomorphic functions we provide are not strictly more general than the polymorphic versions. But in the case of MonoFoldable, I believe we want end-users to treat this as a drop-in replacement for Foldable. So I propose: in the case of only a MonoFoldable constraint, remove the prefixo
.I'm not 100% behind all of these ideas, I'm sharing them now to try and elicit useful feedback.