Features Elm (programming language)




1 features

1.1 immutability
1.2 static types
1.3 module system
1.4 interoperability html, css, , javascript





features

elm has small expressive set of language constructs, including traditional if-expressions, let-expressions local state, , case-expressions pattern matching. functional language, supports anonymous functions, functions arguments, , partial application (currying) default. semantics include immutable values, stateless functions, , static typing type inference. elm programs render html through virtual dom, , may interoperate other code using javascript service .


immutability

all values in elm immutable, meaning value cannot modified after created. elm uses persistent data structures implement array, dict, , set libraries.


static types

elm statically typed. type annotations optional (due type inference) encouraged. annotations exist on line above definition (unlike c-family languages types , names interspersed). elm uses single colon mean has type .


types include primitives integers , strings, , basic data structures such lists, tuples, , records. functions have types written arrows, example round : float -> int. union types allow programmer create custom types represent data in way matches problem domain.


types can refer other types, example list int. types capitalized; lowercase names type variables. example, list list of values of unknown type. type of empty list , of argument list.length, agnostic list s elements. there few special types programmers create interact elm runtime. example, html msg represents (virtual) dom tree event handlers produce messages of type msg.


rather allow value implicitly nullable (such javascript s undefined or null pointer), elm s standard library defines maybe type. code produces or handles optional value explicitly using type, , other code guaranteed value of claimed type present.


module system

elm has module system allows users break code smaller parts called modules. modules can hide implementation details such helper functions, , group related code together. modules serve namespace imported code, such bitwise.and. third party libraries (or packages) consist of 1 or more modules, , available elm public library. libraries versioned according semver, enforced compiler , other tools. is, removing function or changing type can done in major release.


interoperability html, css, , javascript

elm uses abstraction called ports communicate javascript. allows values flow in , out of elm programs, making possible communicate between elm , javascript.


elm has library called elm-html programmer can use write html , css within elm. uses virtual dom approach make updates efficient.








Comments

Popular posts from this blog

Discography Kassav'

History New York State Route 133

History Women in science