You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jonsterling would you mind outlining how you think this would work and affect the language again? Nitty gritty doesn't matter too much, but just so we all have a broad picture to start with at least.
Reacted by Risto Stevcev, Sean Vieira and Felipe S. S. Schneider
So, the basic idea is that first we impose an ML-style module system. My perspective is that we should start as minimally as possible (we will want signatures, structures and generative functors), but it may be useful to also consider the addition of applicative functors, especially in the context of type classes. (There is broad disagreement about whether or not applicative functors are in fact useful, but I have a feeling that they may at least come in handy sometimes, even if a lack of them can usually be worked around.)
After modules have been introduced, the replacement of type classes could proceed in a couple different directions. Both approaches that I will describe adequately address the devastatingly anti-modular character of globally coherent type classes. Global coherence is, contrary to the near-religious belief of many Haskell users and enthusiasts, an anti-feature—and many of the standard examples of where it is useful (for instance, in the SET signature) can be dealt with more elegantly using the facilities of a proper module system.
Modular Type Classes (Dreyer, Harper, Chakravarty)
One option is Dreyer, Harper and Chakravarty's Modular Type Classes, which essentially work in the following way:
Signatures that have a type member called t are treated as "type classes", where the t is used for resolution in the same way as the type parameter of a unary type class is used in Haskell.
Type class instances are just structures that ascribe a particular signature; for things like Show a => Show [a], you use an ML functor. The definition of a structure is totally separate from its canonicalization as "the" instance of that signature.
Overloaded operations may be defined by appealing to some signature, as follows:
Let's say that we have a signature like SHOW:
signature SHOW =
sigtypetval show : t -> string
end
Then, we can define a top-level function called show works on any type s for which an instance of SHOW where type t = s can be resolved by the elaborator (more on that later):
val show = overload show from SHOW
Let's run through a little example:
structure IntShow : SHOW =
structtype t = int
funshow x = Int.toString x
end
Then, separately, we are allowed to canonicalize the IntShow instance in a scope at the top level:
using IntShow inval example = show 12
Now, you should look at the paper for more details, but the idea is that canonicalization is only supported at the top level of a development; the top-level of the development can include structures, signatures, functors, etc.
So, this constitutes a pretty big paradigm shift for PureScript code—no longer would we have, for instance, a library that defines type class instances canonicalize those instances globally. Instead, they would be canonicalized where the user wants them to be via a using declaration. The idea is that definition should always be separated from canonicalization.
I could go into more detail, but I recommend reading the paper and then following up with questions. I am also certain that Bob Harper would be delighted to answer any of our questions on this if there is something he can clarify.
Modular Implicits (White, Bour, Yallop)
Another alternative to Modular Type Classes is Modular Implicits, which are implemented as an extension to OCaml now. Before I begin to summarize them, please note that these are not the same as Scala implicits, so do not dismiss them out of hand. Whereas Scala implicits are resolved by imposing an order on available instances, Modular Implicits (like Modular Type Classes) are only resolved in case there is a unique instance.
I am less familiar with the technical deals of Modular Implicits (and sadly, the paper is more "example-based" and does not include a real specification); I am also unsatisfied with some of the claims made in the paper, but it is possible that I just haven't understood there perspective well enough.
With that said, Modular Implicits are a lot more flexible than Modular Type Classes (see section 7.5 for a summary of the MTC-imposed restrictions that are lifted under the Implicits paradigm).
If he is willing to weigh in, @freebroccolo may be able to comment more intelligently than I on this approach, since he has used it quite a bit in some OCaml developments.
Remark
I think I may prefer the simplicity of MTCs over modular implicits (though, if I had a more technical/detailed paper to look at for the latter, my opinion might change), but I want to emphasize that either of these approaches would be a huge step forward, since they both involve the imposition of a separation between definition and canonicalization, which is absolutely crucial to separate & modular development.
The other thing to mention is that with both these approaches, we get Haskell's "associated types" for free as a special case of the fact that you can declare a type member in a signature.
@jonsterling do you know if MTC allows for multiple instances for a class to be resolved in the same using scope? For example, if I have show x <> show y where x :: Int, y :: Number?
I wonder what this would look like in the case of something like Halogen, or monad transformers, where we need to bring lots of dictionaries into scope to do anything useful.
@paf31 I think the user would just start canonicalizing these structures until their code typechecks; in practice, you might provide a way to declare "standard" canonicalizations such that they can be imported into a top-level scope.
so one can't accidentally break the map invariants by using the wrong Ord instance, unlike when you use the regular implicit approach.
I think this is covered by existentially quantified generative functors. This is partly why I think if you're going to mix type classes and modules the latter are better differentiated by having generativity only and not both like OCaml.
I came across some information that may influence your design here. Derek Dreyer gave a talk back in 2007 entitled "Why Applicative Functors Matter". It turns out that this was in relation to MTCs. His new thinking seems to be that if you have pure modules then you only need applicative functors (rather than generative functors). At least that's my understanding.
Despite much work on the semantics of ML modules, the key distinction between the SML and OCaml module systems - namely, that SML supports generative functors, while OCaml supports applicative functors - remains an issue that few people understand. The main reason, I claim, is that while generativity is critical for ensuring data abstraction in the presence of mutable state, the traditional motivations given for applicativity based on higher-order module programming are not per se very compelling. Another issue is that the question of how to define module equivalence - a key question in applicative functor semantics - has not been satisfactorily resolved.
In this talk, I offer a new, more compelling justification for the importance of applicative functors that I discovered while developing (with Bob Harper and Manuel Chakravarty) modular type classes (POPL'07). While the original MTC framework only supported generative functors, I argue that extending it with applicative functors is a good idea for several reasons. First, applicative functors significantly enhance the expressiveness of modular type classes by enabling the definition of implicitly-typed operations over generic data types implemented by functors. Second, they allow us to more properly model the functionality of Chakravarty et al.'s associated types. Lastly, the extension of MTC to support applicative functors suggests a simple, elegant generalization of term overloading to module overloading, i.e. the ability to project components from an (applicative) functor as if it were a structure.
The use of applicative functors in MTC demands that their dynamic components be purely functional. As it turns out, this purely functional restriction also makes it easy to define module equivalence in a way that conservatively approximates contextual equivalence, and thus preserves data abstraction. This leads me to the conclusion that the complexities of earlier module systems (including my own) should be dropped in favor of the simple slogan: "A functor is applicative if and only if its dynamic components are purely functional."
I'm no expert and will be unlikely to answer further questions. I have had an interest in module systems and MTCs in particular—you may find my notes helpful. I once wrote to Derek Dreyer though and I reckon he'd be approachable if you'd like to get his input.
I'd say—be aware that module systems are quite difficult to understand and tend to be quite verbose in their usage (the theory is way beyond my current understanding). However, in a quick chat with @ekmett, he revealed that he'd like to have (globally unique) type classes and an ML-like module system in his ideal PL. Food for thought.
I'd love to understand the differences between MTCs and Modular Implicits as introduced by OCaml.
@steshaw Applicative-only is fine if you trust other people to never use effects in module instantiation.
That is…not a terribly safe assumption in OCaml, Scala, or otherwise. Certainly it'll let more stuff typecheck. You decide if that's good enough for you or not.
I'd like to have typeclasses and ML modules side-by-side the same as Ed, I've been saying that all throughout. I'm just not willing to ruin the point of typeclasses in doing so. That is, when I say I want both, I mean:
I want both.
Not 1/3 of typeclasses + ML modules. Not half of typeclasses + ML modules. Both. That means global uniqueness for the typeclasses and the classes/instances don't get sealed by the modules (and ideally are the only such thing that's true for). It's not a particularly novel idea, it's just that nobody's made a language that does this. If this was done, the uses of typeclasses could be more limited to principled and proper applications of the system and then stuff that wasn't especially unique or principled (I'd put Monoid and Applicative in the typeclass bucket. Some would disagree because of non-uniqueness) can get moved over.
Maybe each of us should just go and create our own ideal programming languages 😜 (well, I suppose I am doing that in some sense), since there seems to be an impasse:
Some people's goal is to add modules
Other people's goal is to support modularity
I am in the latter camp—and global uniqueness (or, in fact, any global principle at all) is just incompatible with modularity, which is why I don't really see my goals advanced by supporting both Haskell-style type classes and modules. (The very ironic/Hegelian thing is, this little thought experiment shows that modularity is not itself modular—since it relies on the absence of anti-modularity!)
I understand, and am empathetic to those who rely on having the affordances of those things; I'm willing to admit that my goal, of enabling modularity (at the expense of such affordances, even if it gives us space to create different, maybe more interesting ones) may not be aligned with what regular people want.
I was hoping that we could try going a different route in PureScript from what Haskell did; but I have a feeling that the superficial similarities of the languages, and the common community that they attract, may make this impossible.
One thing which has bothered me a bit since starting to think about module systems generally is this: it seems like it's possible to get a decent amount of modularity by using some combination of records, HKP, type classes and rank N types.
Here is an example:
typeCryptoModuleenc={encrypt::foralla. Bytesa=>a->enca
, decrypt::foralla. Bytesa=>enca->Maybea}-- An implementationdataAESa = ...
aes::CryptoModuleAES
aes = ...
-- We can use the implementations as regular valuessimpleUsage::CryptoModuleAES-> ...
-- or polymorphically:polyUsage::forallenc. CryptoModuleenc-> ...
-- Or we can bundle dictionaries with the implementation:-- (now any dictionaries are not canonicalized globally, since they are specific to a-- skolemized type variable)typeBundledCryptoModule=forallr. (forallenc. Show1enc=>CryptoModuleenc->r) ->r-- With extensions like constraint kinds, we can even bundle higher order constraints:typeHOCryptoModuleenc={encrypt::foralla. Bytesa=>a->enca
, decrypt::foralla. Bytesa=>enca->Maybea
, showable::foralla. Dict (Showa) ->Dict (Show (enca))
}
(Please excuse the poor choice of example, it was tricky to come up with something which demonstrated everything)
Can someone in the know please contrast this sort of approach with the existing suggestions?
I haven't read any of the literature yet to comment on the specifics, but I'd like to comment on @jonsterling's previous comment:
Some people's goal is to add modules
Other people's goal is to support modularity
Modules are really important for PureScript right now (as said previously) because they'd allow solving the current problem with composing modules and building a better package management facility. In turn, this would make it easier for people to consume and share PureScript libraries—a necessary thing if we want to improve the ecosystem.
Once libraries are easier to consume and share, however, it's likely that people will start writing a fair bit more of them (see npm), and that's where modularity starts to matter quite a bit. If you install two packages, each of which pulls in several other packages, and they each define similar type class instances, how do you deal with the incompatibility? Making the resolution of type class instances local (as per what I understood from MTL) solves that problem without having to ditch one of the packages entirely, or fork it to change it's source code (both of which are bad imo).
Reacted by Jon Sterling, 文宇祥, Andrew, maddie, John A. De Goes and Pauan
Perhaps it'd be worth dropping typeclasses and going full-hog with modules as an experiment? GHCJS is there for the people that prefer the trade-offs of typeclasses — and it cannot change like PureScript can.
It'd be nice to see what happens when a community switches from one to the other.
I answered this question at length in my February 15th comment on this thread
You're right, sorry. It's good to have an example to work from though. I'll have another look through what you wrote.
Perhaps it'd be worth dropping typeclasses and going full-hog with modules just as an experiment?
I think it'd be better to test out any module system in an experimental branch. Ditching type classes in the main compiler now seems like a good way to lose most of our users, but I'd be interested to see the ideas demonstrated.
I did a read-through of a bunch of the papers on ML modules dating back to the early 1990s recently, although it was a bit Leroy/Harper centric. I haven't caught up on everything MPI-SWS has been up lately, but here's a listing for more depth, biased by what I could understand:
A Type-Theoretic Approach to Higher-Order Modules with Sharing Lays out structures, signatures, and functors more or less as they work in SML. Personally, without the structural subtyping/transparent ascription, I'm not sure modules would be worth it for me personally since you end up with the "whose signature is it anyway?" problem that typeclasses have. YMMV.
A note on generativity: the justification given for generative module functors today is abstraction, but the original paper (which I cannot dig up) seemed to say generativity was easier to type-check.
Lastly, I'd say you really just need to fire up an ocaml and an SML compiler, pick a few problems (like the classic priority queue, maybe try porting stuff we usually do in typeclasses) to really get a feel of what each system lets you express.
Generative modules are easier to type-check, but they don't come for free. If you have, say a Set module, parameterized over the order it is using in a generative manner, then two libraries that don't know about each other can't give back sets of integers that interoperate. Each will be generating a set module of its own, and sets from one can't be used with sets from the other for things like union, etc.
This seems somewhat antithetical to code reuse to me.
Ultimately, I'd not want to give up Haskell-style typeclasses for ML modules, but I'd happily take as much of ML style modules as we can get without giving up Haskell-style typeclasses.
Ed---Not sure I disagree about generative vs applicative, but such a library can absolutely return compatible set objects, by functorizing over an implementation of the SET signature.
Obviously, this may not be ideal, and I tend to think both applicative and generative abstraction should be supported (if only to learn by experience whether there is in practice any use for the former). Always nice to have options!
Generative modules are easier to type-check, but they don't come for free. If you have, say a Set module, parameterized over the order it is using in a generative manner, then two libraries that don't know about each other can't give back sets of integers that interoperate. Each will be generating a set module of its own, and sets from one can't be used with sets from the other for things like union, etc.
This seems somewhat antithetical to code reuse to me.
Ultimately, I'd not want to give up Haskell-style typeclasses for ML modules, but I'd happily take as much of ML style modules as we can get without giving up Haskell-style typeclasses.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Activity
jdegoes commentedon Feb 14, 2016
😍 Cool.
jonsterling commentedon Feb 14, 2016
So, the basic idea is that first we impose an ML-style module system. My perspective is that we should start as minimally as possible (we will want signatures, structures and generative functors), but it may be useful to also consider the addition of applicative functors, especially in the context of type classes. (There is broad disagreement about whether or not applicative functors are in fact useful, but I have a feeling that they may at least come in handy sometimes, even if a lack of them can usually be worked around.)
After modules have been introduced, the replacement of type classes could proceed in a couple different directions. Both approaches that I will describe adequately address the devastatingly anti-modular character of globally coherent type classes. Global coherence is, contrary to the near-religious belief of many Haskell users and enthusiasts, an anti-feature—and many of the standard examples of where it is useful (for instance, in the
SETsignature) can be dealt with more elegantly using the facilities of a proper module system.Modular Type Classes (Dreyer, Harper, Chakravarty)
One option is Dreyer, Harper and Chakravarty's Modular Type Classes, which essentially work in the following way:
tare treated as "type classes", where thetis used for resolution in the same way as the type parameter of a unary type class is used in Haskell.Show a => Show [a], you use an ML functor. The definition of a structure is totally separate from its canonicalization as "the" instance of that signature.Let's say that we have a signature like
SHOW:Then, we can define a top-level function called
showworks on any typesfor which an instance ofSHOW where type t = scan be resolved by the elaborator (more on that later):val show = overload show from SHOWLet's run through a little example:
Then, separately, we are allowed to canonicalize the
IntShowinstance in a scope at the top level:Now, you should look at the paper for more details, but the idea is that canonicalization is only supported at the top level of a development; the top-level of the development can include structures, signatures, functors, etc.
So, this constitutes a pretty big paradigm shift for PureScript code—no longer would we have, for instance, a library that defines type class instances canonicalize those instances globally. Instead, they would be canonicalized where the user wants them to be via a
usingdeclaration. The idea is that definition should always be separated from canonicalization.I could go into more detail, but I recommend reading the paper and then following up with questions. I am also certain that Bob Harper would be delighted to answer any of our questions on this if there is something he can clarify.
Modular Implicits (White, Bour, Yallop)
Another alternative to Modular Type Classes is Modular Implicits, which are implemented as an extension to OCaml now. Before I begin to summarize them, please note that these are not the same as Scala implicits, so do not dismiss them out of hand. Whereas Scala implicits are resolved by imposing an order on available instances, Modular Implicits (like Modular Type Classes) are only resolved in case there is a unique instance.
I am less familiar with the technical deals of Modular Implicits (and sadly, the paper is more "example-based" and does not include a real specification); I am also unsatisfied with some of the claims made in the paper, but it is possible that I just haven't understood there perspective well enough.
With that said, Modular Implicits are a lot more flexible than Modular Type Classes (see section 7.5 for a summary of the MTC-imposed restrictions that are lifted under the Implicits paradigm).
If he is willing to weigh in, @freebroccolo may be able to comment more intelligently than I on this approach, since he has used it quite a bit in some OCaml developments.
Remark
I think I may prefer the simplicity of MTCs over modular implicits (though, if I had a more technical/detailed paper to look at for the latter, my opinion might change), but I want to emphasize that either of these approaches would be a huge step forward, since they both involve the imposition of a separation between definition and canonicalization, which is absolutely crucial to separate & modular development.
jonsterling commentedon Feb 14, 2016
The other thing to mention is that with both these approaches, we get Haskell's "associated types" for free as a special case of the fact that you can declare a type member in a signature.
jdegoes commentedon Feb 14, 2016
We're a step in this direction already, with named instances, and type classes that are compiled to records.
garyb commentedon Feb 15, 2016
@jonsterling do you know if MTC allows for multiple instances for a class to be resolved in the same
usingscope? For example, if I haveshow x <> show ywherex :: Int,y :: Number?jonsterling commentedon Feb 15, 2016
@garyb That ought to work fine
paf31 commentedon Feb 16, 2016
I wonder what this would look like in the case of something like Halogen, or monad transformers, where we need to bring lots of dictionaries into scope to do anything useful.
jonsterling commentedon Feb 16, 2016
@paf31 Are you referring to the need to explicitly canonicalize a structure? Or something else?
paf31 commentedon Feb 16, 2016
Yes, I think so. Please take my comments with a pinch of salt until I finish reading the literature though.
jonsterling commentedon Feb 16, 2016
@paf31 I think the user would just start canonicalizing these structures until their code typechecks; in practice, you might provide a way to declare "standard" canonicalizations such that they can be imported into a top-level scope.
45 remaining items
bitemyapp commentedon May 1, 2016
@rightfold
I think this is covered by existentially quantified generative functors. This is partly why I think if you're going to mix type classes and modules the latter are better differentiated by having generativity only and not both like OCaml.
steshaw commentedon Jun 8, 2016
I came across some information that may influence your design here. Derek Dreyer gave a talk back in 2007 entitled "Why Applicative Functors Matter". It turns out that this was in relation to MTCs. His new thinking seems to be that if you have pure modules then you only need applicative functors (rather than generative functors). At least that's my understanding.
From http://www.cs.ox.ac.uk/ralf.hinze/WG2.8/24/minutes.html:
This seems to indicate that you may only require applicative functors In PureScript. There is a related discussion on reddit about global coherence of type classes in Haskell and MTC.
I'm no expert and will be unlikely to answer further questions. I have had an interest in module systems and MTCs in particular—you may find my notes helpful. I once wrote to Derek Dreyer though and I reckon he'd be approachable if you'd like to get his input.
I'd say—be aware that module systems are quite difficult to understand and tend to be quite verbose in their usage (the theory is way beyond my current understanding). However, in a quick chat with @ekmett, he revealed that he'd like to have (globally unique) type classes and an ML-like module system in his ideal PL. Food for thought.
I'd love to understand the differences between MTCs and Modular Implicits as introduced by OCaml.
bitemyapp commentedon Jun 8, 2016
@steshaw Applicative-only is fine if you trust other people to never use effects in module instantiation.
That is…not a terribly safe assumption in OCaml, Scala, or otherwise. Certainly it'll let more stuff typecheck. You decide if that's good enough for you or not.
I'd like to have typeclasses and ML modules side-by-side the same as Ed, I've been saying that all throughout. I'm just not willing to ruin the point of typeclasses in doing so. That is, when I say I want both, I mean:
I want both.
Not 1/3 of typeclasses + ML modules. Not half of typeclasses + ML modules. Both. That means global uniqueness for the typeclasses and the classes/instances don't get sealed by the modules (and ideally are the only such thing that's true for). It's not a particularly novel idea, it's just that nobody's made a language that does this. If this was done, the uses of typeclasses could be more limited to principled and proper applications of the system and then stuff that wasn't especially unique or principled (I'd put Monoid and Applicative in the typeclass bucket. Some would disagree because of non-uniqueness) can get moved over.
jonsterling commentedon Jun 8, 2016
Maybe each of us should just go and create our own ideal programming languages 😜 (well, I suppose I am doing that in some sense), since there seems to be an impasse:
I am in the latter camp—and global uniqueness (or, in fact, any global principle at all) is just incompatible with modularity, which is why I don't really see my goals advanced by supporting both Haskell-style type classes and modules. (The very ironic/Hegelian thing is, this little thought experiment shows that modularity is not itself modular—since it relies on the absence of anti-modularity!)
I understand, and am empathetic to those who rely on having the affordances of those things; I'm willing to admit that my goal, of enabling modularity (at the expense of such affordances, even if it gives us space to create different, maybe more interesting ones) may not be aligned with what regular people want.
I was hoping that we could try going a different route in PureScript from what Haskell did; but I have a feeling that the superficial similarities of the languages, and the common community that they attract, may make this impossible.
paf31 commentedon Jun 8, 2016
One thing which has bothered me a bit since starting to think about module systems generally is this: it seems like it's possible to get a decent amount of modularity by using some combination of records, HKP, type classes and rank N types.
Here is an example:
(Please excuse the poor choice of example, it was tricky to come up with something which demonstrated everything)
Can someone in the know please contrast this sort of approach with the existing suggestions?
jonsterling commentedon Jun 8, 2016
@paf31 I answered this question at length in my February 15th comment on this thread, here: #1886 (comment)
robotlolita commentedon Jun 8, 2016
I haven't read any of the literature yet to comment on the specifics, but I'd like to comment on @jonsterling's previous comment:
Modules are really important for PureScript right now (as said previously) because they'd allow solving the current problem with composing modules and building a better package management facility. In turn, this would make it easier for people to consume and share PureScript libraries—a necessary thing if we want to improve the ecosystem.
Once libraries are easier to consume and share, however, it's likely that people will start writing a fair bit more of them (see npm), and that's where modularity starts to matter quite a bit. If you install two packages, each of which pulls in several other packages, and they each define similar type class instances, how do you deal with the incompatibility? Making the resolution of type class instances local (as per what I understood from MTL) solves that problem without having to ditch one of the packages entirely, or fork it to change it's source code (both of which are bad imo).
bitemyapp commentedon Jun 8, 2016
Perhaps it'd be worth dropping typeclasses and going full-hog with modules as an experiment? GHCJS is there for the people that prefer the trade-offs of typeclasses — and it cannot change like PureScript can.
It'd be nice to see what happens when a community switches from one to the other.
paf31 commentedon Jun 8, 2016
You're right, sorry. It's good to have an example to work from though. I'll have another look through what you wrote.
I think it'd be better to test out any module system in an experimental branch. Ditching type classes in the main compiler now seems like a good way to lose most of our users, but I'd be interested to see the ideas demonstrated.
paf31 commentedon Jun 10, 2016
I found this to be a very handy brief introduction to the subject of ML modules, for anyone who is looking for something similar.
bitemyapp commentedon Jun 10, 2016
I did a read-through of a bunch of the papers on ML modules dating back to the early 1990s recently, although it was a bit Leroy/Harper centric. I haven't caught up on everything MPI-SWS has been up lately, but here's a listing for more depth, biased by what I could understand:
A note on generativity: the justification given for generative module functors today is abstraction, but the original paper (which I cannot dig up) seemed to say generativity was easier to type-check.
Lastly, I'd say you really just need to fire up an ocaml and an SML compiler, pick a few problems (like the classic priority queue, maybe try porting stuff we usually do in typeclasses) to really get a feel of what each system lets you express.
bitemyapp commentedon Jun 10, 2016
@paf31 dunno how useful it would be to you, but if PureScript is System Fω under the hood, this might be of use: http://research.microsoft.com/en-us/um/people/crusso/papers/fingmodules.pdf
ekmett commentedon Jun 11, 2016
Generative modules are easier to type-check, but they don't come for free. If you have, say a Set module, parameterized over the order it is using in a generative manner, then two libraries that don't know about each other can't give back sets of integers that interoperate. Each will be generating a set module of its own, and sets from one can't be used with sets from the other for things like
union, etc.This seems somewhat antithetical to code reuse to me.
Ultimately, I'd not want to give up Haskell-style typeclasses for ML modules, but I'd happily take as much of ML style modules as we can get without giving up Haskell-style typeclasses.
jonsterling commentedon Jun 11, 2016
Ed---Not sure I disagree about generative vs applicative, but such a library can absolutely return compatible set objects, by functorizing over an implementation of the SET signature.
Obviously, this may not be ideal, and I tend to think both applicative and generative abstraction should be supported (if only to learn by experience whether there is in practice any use for the former). Always nice to have options!