시작해보기

온라인 에디터로 시작하기

처음부터 모든 것을 설치하기 부담스러운 분이 계실거에요. 그런 분들은 이 온라인 에디터를 사용하시면 됩니다. 다음 "언어의 핵심" 부분에서는 REPL을 사용하실 수 없지만 그 외의 모든 것은 다 잘 돌아갑니다!

온라인 에디터로 조그만 Elm 프로그램을 만드는 이 예제들도 있습니다.

설치

혹은 Elm으로 작업하기 위한 모든 커맨드라인 도구들이 담겨있는 “Elm 플랫폼”을 설치할 수 있습니다.

Elm Platform에 딸려오는 도구들은 본 문서 뒷 부분에서 다룰 것 입니다!

에디터 설정하기

다음 데이터에는 Elm 문법 하이라이터가 지원됩니다:

만약에 에디터가 없으시다면 서브라임 텍스트로 시작하면 좋을거에요!

문제가 생겼어요!

The fastest way to learn anything is to talk with other people in the Elm community. We are friendly and happy to help! So if you get stuck during installation or encounter something weird, visit the Elm Slack and ask about it. In fact, if you run into something confusing at any point while learning or using Elm, come ask us about it. You can save yourself hours. Just do it!

What is the Elm Platform?

After installing Elm successfully, you will have the following command line tools available on your computer:

Each one has a --help flag that will show more information. Let's go over them here though!

elm-repl

elm-repl lets you play with simple Elm expressions.

$ elm-repl
---- elm-repl 0.17.1 -----------------------------------------------------------
 :help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> 1 / 2
0.5 : Float
> List.length [1,2,3,4]
4 : Int
> List.reverse ["Alice","Bob"]
["Bob","Alice"] : List String

We will be using elm-repl in the upcoming “Core Language” section, and you can read more about how it works here.

Note: elm-repl works by compiling code to JavaScript, so make sure you have Node.js installed. We use that to evaluate code.

elm-reactor

elm-reactor helps you build Elm projects without messing with the command-line too much. You just run it at the root of your project, like this:

git clone https://github.com/evancz/elm-architecture-tutorial.git
cd elm-architecture-tutorial
elm-reactor

This starts a server at http://localhost:8000. You can navigate to any Elm file and see what it looks like. Try to check out examples/1-button.elm.

Notable flags:

  • --port lets you pick something besides port 8000. So you can say elm-reactor --port=8123 to get things to run at http://localhost:8123.
  • --address lets you replace localhost with some other address. For example, you may want to use elm-reactor --address=0.0.0.0 if you want to try out an Elm program on a mobile device through your local network.

elm-make

elm-make builds Elm projects. It can compile Elm code to HTML or JavaScript. It is the most general way to compile Elm code, so if your project becomes too advanced for elm-reactor, you will want to start using elm-make directly.

Say you want to compile Main.elm to an HTML file named main.html. You would run this command:

elm-make Main.elm --output=main.html

Notable flags:

  • --warn prints warnings to improve code quality

elm-package

elm-package downloads and publishes packages from our package catalog. As community members solve problems in a nice way, they share their code in the package catalog for anyone to use!

Say you want to use evancz/elm-http and NoRedInk/elm-decode-pipeline to make HTTP requests to a server and turn the resulting JSON into Elm values. You would say:

elm-package install evancz/elm-http
elm-package install NoRedInk/elm-decode-pipeline

This will add the dependencies to your elm-package.json file that describes your project. (Or create it if you do not have one yet!) More information about all this here!

Notable commands:

  • install: install the dependencies in elm-package.json
  • publish: publish your library to the Elm Package Catalog
  • bump: bump version numbers based on API changes
  • diff: get the difference between two APIs

results matching ""

    No results matching ""