--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
type alias Reducer a r = r -> a -> r
type alias Transducer a b = for all r in Reducer a r -> Reducer b r
for all a, b, c, d in ...
Higher-kinded parameters might be a month or two away if it's prioritized or another contributor takes ownership. Either higher-rank types or traits/classes or something in that space is probably multiple months away, and similarly, this is a best case scenario that it is either prioritized or another contributor takes ownership.
Knowing that, your best bet is to wait for Evan to outline his goals for the next release, which he usually does a few weeks after the past release. Give him a chance to recover from jet lag! Asking in this manner is, frankly, stress inducing, not particularly productive, and never quite illuminating.
-OR-
I don't know what your project is like, if it's commercial or under contract or just a large personal project, but if you find yourself in the situation where you need a language feature, why not scratch your own itch and try to make the contribution?
(Those are probably conservative estimates. The right person might be able to knock out higher kinds in a weekend and higher rank in a month. Elm is open source. Such a person could make a temporary fork and prove the benefits)
Sorry for the confusion.
What I'm saying is, if we have Type Constructors as parameters (HKP), shouldn't that together with records be enough to simulate most useful aspects of Typeclasses?
Then you can write something like:
type alias Mappable = {map : (a -> b) -> m a -> m b }
I don't see why we'd need to be able to move the foralls inwards, but I could be missing something from the theory where we would need that. There are some functions you could write more generally, but these seem like much more of a fringe case than, for example, having a "Comparable" typeclass.
I think what this ultimately comes down to is the generality vs. complexity tradeoff. Sometimes writing the most generic code isn't optimal, because you solve more than the problem at hand.
It's also important to think about the implications this has for type inference. "No type signatures ever needed" is a very nice promise, and to a non-academic, saying "we have a complex type system, and sometimes you need to figure out the signatures yourself" can be quite intimidating.
(Those are probably conservative estimates. The right person might be able to knock out higher kinds in a weekend and higher rank in a month. Elm is open source. Such a person could make a temporary fork and prove the benefits)
--
Well, from Paul's earlier post:
"Part of the problem with this request is that the limitations (of not having any of the features I asked about) can always be worked around by duplicating code,... there can be huge amounts of code duplication due to the lack of ability to do certain kinds of abstraction."
So I'm curious, which certain kinds of abstraction? Maybe rather than examples, you can share the patterns that you want to employ. And point us to blog posts about why they are valuable.
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/EZ17hBTXr2I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
--
Anyway, this is just one example, let's not dwell on it too much.
Having one `AbstractSyntaxTree` type for all of them would mean giving up type safety - the types no longer enforce that trees are well-formed as types/terms/whatever, and when you are pattern matching on trees (which you tend to do a lot in a compiler) you have no idea if what you are getting is valid.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Elm Discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elm-discuss/EZ17hBTXr2I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elm-discuss...@googlegroups.com.
Does the example have to be Mario in the browser or the interface for a CRUD app for it to "count"?
pattern matching coverage checking
the "base functor" `f` in `Term f`
capture-avoiding variable substitution
I get that people want examples that are relevant to what they happen to be interested in doing with Elm, but I feel the point has been missed. The point is that there can often be (lots of) code duplication without these features.
> ...so you could accidentally pass a JavaScript AST instance to optimizeElmAST and the compiler would not complain?
That is one example, yes. You also have no assurance when you are building these trees that you haven't mixed them up and done something silly like included a let binding in an AST that's supposed to be a Type, say. You also lose pattern matching coverage checking (once Elm adds that) when inspecting these trees. It's all very dynamically typed, too ugly to really consider IMO.
I get that people want examples that are relevant to what they happen to be interested in doing with Elm, but I feel the point has been missed. The point is that there can often be (lots of) code duplication without these features. The argument I gave for that is very general, even though I picked just a few examples. But anyone making good use of these features can come up with their own compelling examples (for them) for whatever they happen to be doing.
--
Max, I also think you are right. I guess I did have some hope that even if I'm not the "target market" for Elm I could still use it since it's a nice tool in many ways. Anyway, I'm glad for the work that Evan and others have done, even if Elm doesn't end up working out for my project.