type alias Outcome a = Result String a
List (Maybe a) -> Maybe (List a)
List (r -> a) -> r -> (List a)
List (Task x a) -> Task x (List a)
I think names like "monad" and "functor" are going to be confusing to people, and so far the approach taken has been to talk about the operations (verbs) rather than the class (noun). For example, "tasks support andThen" rather than "tasks are monads".
However, I disagree with the notion that stating "this module is a monad" will be helpful to programmers. If you come from Haskell and are familiar with its type classes, you can typically recognize them by their type signature
I hope you like Elm and stick around, but if you want something closer to Haskell, you can also try ghcJS and PureScript.
Learning curve is a major known problem. The top two autocompletes for "why is haskell" are "why is haskell lazy" and "why is haskell so hard to learn" - so it's reasonable to be wary of having Elm introduce complex Haskell concepts even under the banner of "advanced users only."
Building on top of abstractions like Monad and Applicative leads naturally to other, even more complex abstractions like Monad Transformers. As Evan put it in another thread, it took him years to understand Monad Transformers, and he is a highly accomplished programmer coming from a strong functional background.
You sometimes have to copy/paste a bit more boilerplate
Every time I tell non-Haskellers that they won't have to learn Monads to get into Elm, they show noticeable signs of relief and get more interested.
It seems to me that monad as a programming term has been ruined unintentionally by Haskell, which is part of why it is so hard for people to understand.
(Tl;dr of the rest... These terms should be replaced because Haskell messed them up)
People say things like "the Maybe Monad" or "monads are for IO" and the imprecise language here can really muddle things up. From a modeling perspective Maybe is not really a Monad, but you can easily make a Monad from it.
In Haskell you can use Maybe as if it is a Monad, and they overload things using type classes so that it works, in a kind of magical way.
A Monad is a trio of functions/morphisms following certain rules. Maybe, the type constructor, is the first function. In Haskell using a type class instance Maybe instances implicitly carry around the other two functions (return and bind).
A less indirect way of building the monads would be to just define a data type with the three functions. But then some convenience would be lost... And I'm not sure Haskell even allows you to put a type constructor into a data type.
So the result is a lot confused people confused between the Haskell idea of monads and the formal definition of it that are fairly different. The same goes for things like applicative, functor, and so on. The Haskell version is encoded into type classes as a kind of approximation of the original concept, causing mayhem for beginners.
This, I do think we may need new terms for these things because of their confusing usage in the programming world up to now.
--
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.
Learning curve is a major known problem. The top two autocompletes for "why is haskell" are "why is haskell lazy" and "why is haskell so hard to learn" - so it's reasonable to be wary of having Elm introduce complex Haskell concepts even under the banner of "advanced users only."I do not see how having these features under the banner of "advanced features only" would scare people off if they are not essential language features. You don't need to add it to "why use Elm" overviews. Elm stands on its own already for the reasons I stated in my response to Max. Honestly, the whole "it will scare people off" is a much less compelling argument than "it's not worth the effort to implement at this time". I'm not advocating that Elm build its identity around these features, only requesting that we acknowledge their existence.
Building on top of abstractions like Monad and Applicative leads naturally to other, even more complex abstractions like Monad Transformers. As Evan put it in another thread, it took him years to understand Monad Transformers, and he is a highly accomplished programmer coming from a strong functional background.This is a slippery-slope argument. Just because we talk about concepts like Monad and Applicative doesn't mean we _must_ talk about Monad Transformers, etc. Monads, etc have their own uses without talking about their more-complex cousins.
You sometimes have to copy/paste a bit more boilerplateGiven that the goal is to attract more users to Elm, isn't it fair to argue that this is one thing which turns people _off_ of Elm? I've done my research, and there are a lot of threads advocating against this duplication. So clearly it's bothering people who want to use Elm.
The problem of inventing a new terminology is that it puts a lot of burden on Elm's documentation. If you say something is a "functor", I can rely on documentation from other languages to understand it, if you call it anything else I will only recognize it as a "functor" if I already know what it is.
Conversely, if I were an imperative JS programmer (as I once was) and came across a FP language community pitching monads (even if clearly pitched as optional)
Conversely, if I were an imperative JS programmer (as I once was) and came across a FP language community pitching monads (even if clearly pitched as optional)The other problem is that optional features, aren't. React.js says their JSX syntax is optional, but I have yet to see a React project that doesn't use it. And now many programmers are writing HTML in the .js files. I guess that's the other reason why it took hold - it was closer to the HTML being generated, an abstraction these folks were familiar with.
I think it's important not to be misled by surface syntax: JSX is not really HTML. It's syntactic sugar for JavaScript function calls that create certain kinds of objects. In particular, a JSX attribute can contain an arbitrary JavaScript object, much like a parameter to a regular function call and unlike HTML where it can only be a string. Being able to construct view nodes anywhere in your program is a more flexible approach than using an external template language where everything you put into a template needs to be converted to HTML.
--
A point I don't think I've made online is this: The amount of brain power lost in discussions about this stuff is crazy. Like my brain right now. Or yours. What if I was getting the 0.15.1 release ready now? Or improving tasks? Or tests? What if you were writing a library for data visualization or animation or calendars or so many useful things?! Richard is starting to use Elm at work, what if he had the time back from writing these emails?
--
I think the point about creating resources for how to recognize common patterns is fair. For someone who has only worked with C-like languages, even type annotations will be strange. Also, if we don't ensure that Elm users all recognize the "andThen pattern", then they may create a function with the same annotation (or flipped) with a different name in a 3rd party library, which will make things much more confusing. These tutorials would also be a good place to indicate the other functions that go with these patterns ("if you write andThen, consider writing sequence like so..."). As for the absence of the term "monad", it may make them harder to find (we'll link to them, no big deal) but it will make readers more likely to get through the document.
--