Giter VIP home page Giter VIP logo

Comments (6)

evancz avatar evancz commented on July 17, 2024

We have discussed this on the list before, and it is unclear that adding type signatures are definitely "the right thing to do" for these examples. Do you mind opening this up for discussion on the forum to get other opinions?

from elm-lang.org.

joehillen avatar joehillen commented on July 17, 2024

There is nothing to discuss. A type-signature is part of the documentation of a function. If this is not the attitude of the elm community, then it's obviously not worth learning and I will just stick to Haskell.

from elm-lang.org.

evancz avatar evancz commented on July 17, 2024

I don't think it is so simple. Type signatures are important, especially in real projects, but I want these examples to be accessible to people who have no familiarity with types. For many people, the examples will be the first interaction with the language and I don't want to throw too many concepts at them at once.

Also, my opinion is not the "Elm community" opinion which is why I think it'd be good to talk about this on the list. I may be wrong that leaving off the types is making the examples more accessible.

from elm-lang.org.

joehillen avatar joehillen commented on July 17, 2024

Well then think of it this way. I was trying to learn elm. I couldn't figure out the types. So as new user, I am asking for the type signatures to be added. Hope that makes it clear.

from elm-lang.org.

lambdatoast avatar lambdatoast commented on July 17, 2024

What to do with the examples' code style should be discussed over at the ML (keeping with the Elm community's tradition of not acting without a thorough discussion).

For example, I too think types are the very best form of documentation, but I like that the examples showcase type inference as well.

For the time being, note that elm-lang's editor will tell you the type, along with a link to the API documentation, if you put the cursor over a name from Elm's built-in library (i.e. sampleOn, toForm, collage, etc).

And if you want to see the type of every name (i.e. the example-specific record types, etc), you could just clone the examples repo to your machine and run elm --print-types on the source of the example in question.

On a related note, showing the output of --print-types is something that's currently being added to share-elm. Maybe elm-lang could do the same.

from elm-lang.org.

evancz avatar evancz commented on July 17, 2024

Types are used a ton more in the examples. I tried to follow "best practice" style in pretty much all of them. Let's open PR's for specific examples if it can be improved.

from elm-lang.org.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.