4.11是什么星座| 梦见床是什么意思| 雷蒙欣氨麻美敏片是什么药| g6pd是检查什么的| 巨蟹座女和什么座最配| 苏打水配什么好喝| 粉色玫瑰花代表什么意思| yankees是什么牌子| 一个鱼一个完读什么| 男人吃逍遥丸治什么病| 什么的梦| 49岁属什么| 寝不言食不语什么意思| 朱砂痣代表什么| 受凉感冒吃什么药| 什么是三好学生| 乳酸脱氢酶是什么| 是什么字| 祭日和忌日是什么意思| 为什么叫夺命大乌苏| 结婚五周年是什么婚| 维生素b6主治什么| 放屁多什么原因| 天天喝可乐有什么危害| 盐酸西替利嗪片主治什么| 麻疹的症状是什么| 奕五行属性是什么| 眼睛白色部分叫什么| 雄黄是什么| 7月4日什么星座| 眼睛干涩用什么药| 水果的英文是什么| 犹太人是什么意思| 茯苓什么味道| 洗衣机什么牌子的好| 花中隐士是什么花| 手抖是什么原因导致的| 小火龙吃什么| 弱碱水是什么水| 吃席是什么意思| 为什么割包皮| 射手是什么星象| 脸部填充用什么填充最好| 什么是门户网站| ader是什么牌子| 心脾两虚吃什么药| 喉咙发炎不能吃什么食物| 狮子男和什么星座最配| iss是什么意思| 泪点低什么意思| 女性为什么会感染巨细胞病毒| 什么水果含糖量低| 南京区委书记什么级别| 子宫内膜3mm意味着什么| 年轻人白头发是什么原因引起的| 大表哥是什么游戏| 狗怀孕有什么症状| 台湾海峡属于什么海| 为什么会抽搐| 苹果什么时间吃最好| 王大锤真名叫什么| 减肥吃什么比较好| 平板电脑是什么| 为什么叫印度阿三| 酒酿蛋什么时候吃效果最好| 痛风什么蔬菜不能吃| 1月1日什么星座| 10.16是什么星座| 酸奶可以做什么美食| 打擦边球是什么意思| 亡羊补牢的亡是什么意思| m倾向是什么意思| 摇头是什么病| 茄子能治什么病| 胃下垂吃什么药| 鼻窦炎用什么药效果最好| 什么水果糖分最高| 餐饮sop是什么意思| 三本是什么| 目鱼和墨鱼有什么区别| 辣椒含有什么维生素| 神经肌电图检查什么| 什么是996| 天外有天人外有人是什么意思| 龙的三合生肖是什么| 今天忌什么宜什么| 什么是伪娘| 白介素高说明什么| 毕业送什么花| 什么是买手店| 三个牛读什么字| 中午一点是什么时辰| 拉肚子低烧是什么原因| 眼红是什么意思| 手信是什么意思| 獭尾肝是什么意思| 什么叫根管治疗| 甲状腺是什么引起的| 指甲盖上有竖纹是什么原因| 知了什么时候叫| 内膜欠均匀是什么意思| 亲热是什么意思| 朝朝暮暮是什么意思| 脑供血不足吃什么| 检查肺结节挂什么科| 晕车喝什么| 表妹是什么意思| 上梁不正下梁歪是什么意思| 什么是有机| 阴茎越来越小是什么原因| 适合是什么意思| 萤火虫吃什么食物| 肛门里面有个肉疙瘩是什么| 为什么警察叫条子| 怀孕初期怕冷是什么原因| 小孩肚脐眼周围疼是什么原因| 臆想症是什么意思| 一什么力量| 结婚36年是什么婚| 脑供血不足什么症状| 心有余而力不足什么意思| 子宫什么样子图片| 尿道感染看什么科| 仙人跳是什么意思| 感冒了吃什么水果比较好| 甲状腺低回声什么意思| 鹿吃什么| 什么菜补铁| 唠嗑是什么意思| 泽去掉三点水念什么| 中心句是什么意思| 梦见离家出走是什么意思| ivy是什么意思| 小孩脚后跟疼是什么原因| 羊的五行属什么| 水上漂是什么意思| 喝啤酒有什么好处| 句号代表什么意思| 十一月五号是什么星座| 容五行属什么| 须眉是什么意思| 痛经挂什么科| 为什么脖子上会长痘痘| 鼓上蚤是什么意思| 茯苓有什么功效和作用| 按摩椅什么牌子最好| 唯小人与女子难养也什么意思| 王林为什么叫王麻子| 坐骨神经有什么症状| 两个土念什么字| 去港澳旅游需要什么证件| 脚心长痣代表什么| 男人阳气不足有什么症状| 什么时候有雨| 麦克白夫人什么意思| 着数是什么意思| 腰椎间盘突出压迫神经吃什么药| 丰的部首是什么偏旁| 石见念什么| 肝斑一般在脸上的什么地方| 血小板是干什么用的| 细菌是什么| 溶菌酶是什么| b7是什么意思| 脉冲是什么| 更年期看什么科| 宝宝老是摇头是什么原因| 什么的云海| 什么洗面奶最好用排行第一| 喉咙一直有痰是什么原因| 肛门是什么意思| 面粉是什么粉| biemlfdlkk是什么牌子| 人际关系是什么意思| o型血不能和什么血型的人生孩子| 萎缩性鼻炎用什么药| 性激素六项什么时候查最准确| 鱼缸为什么不能送人| 孕妇喝什么补羊水最快| 孕妇痔疮犯了能用什么药膏| 内膜b型是什么意思啊| 经信局是做什么的| 粘米粉是什么米做的| 什么钙片补钙效果好| 女孩小名叫什么好| 谷子是什么意思| 非营运车辆是什么意思| 大豆是什么豆| 1989年什么生肖| 九三年属鸡是什么命| 12月20日是什么星座| 怕热的人是什么体质| 导滞是什么意思| 北极和南极有什么区别| 癫狂是什么意思| 转肽酶高是什么原因| 单脱是什么意思| 畏寒肢冷是什么意思| 为什么吃不胖| 睡觉时头晕是什么原因| 罗贯中是什么朝代的| 舒服的意思是什么| 健将是什么意思| 英五行属什么| 什么安神助睡眠| 晚上十点多是什么时辰| 甲功六项检查什么| 请婚假需要什么材料| 什么是肺纤维化| 翘楚是什么意思| 相破是什么意思| 边缘视力是什么意思| 肠胀气是什么原因| ex是什么的缩写| 含义是什么意思| 中耳炎吃什么药效果比较好| 蜈蚣属于什么类动物| 猫对什么颜色感兴趣| 苹果浓缩汁是什么| 头疼 吃什么药| 吃小龙虾不能和什么一起吃| 夕阳无限好是什么意思| 咳嗽喉咙痛吃什么药| 做脑电图挂什么科| 鸡肉不能和什么一起吃| 缄默症是什么病| 紫菜和海带有什么区别| 夜宵吃什么好| 男人吃什么能延时| 国字脸适合什么发型| 口苦口干是什么原因引起的| 缺钾有什么症状| 924是什么星座| 牙冠什么材质的好| 生理盐水敷脸有什么效果| 大什么小什么| 黑曜石属于五行属什么| 巴雷特是什么| 高血压中医叫什么病| 孕酮低吃什么| 鬼压床是什么意思| 奇异果是什么水果| 久坐睾丸疼是什么原因| 迪根是什么药| 纯碱是什么| 瓜尔胶是什么东西| guess是什么品牌| 白带豆腐渣用什么药| 猫呕吐是什么原因| 属羊什么命| 脱髓鞘疾病是什么病| 什么情况下需要做造影| 饭后腹胀是什么原因| 一马平川什么意思| 甘油是什么成分| 放屁多是什么原因引起的| 皮脂膜是什么| 小虾米吃什么| 什么时候满月| 低压偏高有什么危害| 消化不良吃什么水果| 政客是什么意思| 龋齿和蛀牙有什么区别| 经期缩短是什么原因| 百度Jump to content

空调开不了机是什么原因

From Wikipedia, the free encyclopedia
Elm
The Elm tangram
Paradigmfunctional
FamilyHaskell
Designed byEvan Czaplicki
First appearedMarch 30, 2012; 13 years ago (2025-08-06)[1]
Stable release
0.19.1 / October 21, 2019; 5 years ago (2025-08-06)[2]
Typing disciplinestatic, strong, inferred
Platformx86-64
OSmacOS, Windows
LicensePermissive (Revised BSD)[3]
Filename extensions.elm
Websiteelm-lang.org Edit this at Wikidata
Influenced by
Haskell, Standard ML, OCaml, F#
Influenced
Redux,[4] Rust,[5] Vue,[6] Roc,[7] Derw,[8] Gren[9]
百度 这是江北高新区一直盼望的商业配套,地块周边的中建国熙台、正荣润江城、雅居乐滨江国际等业主都要偷着乐了。

Elm is a domain-specific programming language for declaratively creating web browser-based graphical user interfaces. Elm is purely functional, and is developed with emphasis on usability, performance, and robustness. It advertises "no runtime exceptions in practice",[10] made possible by the Elm compiler's static type checking.

History

[edit]

Elm was initially designed by Evan Czaplicki as his thesis in 2012.[11] The first release of Elm came with many examples and an online editor that made it easy to try out in a web browser.[12] Czaplicki joined Prezi in 2013 to work on Elm,[13] and in 2016 moved to NoRedInk as an Open Source Engineer, also starting the Elm Software Foundation.[14]

The initial implementation of the Elm compiler targets HyperText Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript.[15] The set of core tools has continued to expand, now including a read–eval–print loop (REPL),[16] package manager,[17] time-travelling debugger,[18] and installers for macOS and Windows.[19] Elm also has an ecosystem of community created libraries,[20] and Ellie, an advanced online editor that allows saved work and including community libraries.[21]

Features

[edit]

Elm has a small set of language constructs, including traditional if-expressions, let-expressions for storing local values, and case-expressions for pattern matching.[22] As a functional language, it supports anonymous functions, functions as arguments, and functions can return functions, the latter often by partial application of curried functions. Functions are called by value. Its semantics include immutable values, stateless functions, and static typing with type inference. Elm programs render HTML through a virtual DOM, and may interoperate with other code by using "JavaScript as a service".

Immutability

[edit]

All values in Elm are immutable, meaning that a value cannot be modified after it is created. Elm uses persistent data structures to implement its arrays, sets, and dictionaries in the standard library.[23]

Static types

[edit]

Elm is statically typed. Type annotations are optional (due to type inference) but strongly encouraged. Annotations exist on the line above the definition (unlike C-family languages where types and names are interspersed). Elm uses a single colon to mean "has type".

Types include primitives like integers and strings, and basic data structures such as lists, tuples, and records. Functions have types written with arrows, for example round : Float -> Int. Custom types allow the programmer to create custom types to represent data in a way that matches the problem domain.[24]

Types can refer to other types, for example a List Int. Types are always capitalized; lowercase names are type variables. For example, a List a is a list of values of unknown type. It is the type of the empty list and of the argument to List.length, which is agnostic to the list's elements. There are a few special types that programmers create to interact with the Elm runtime. For example, Html Msg represents a (virtual) DOM tree whose event handlers all produce messages of type Msg.

Rather than allow any value to be implicitly nullable (such as JavaScript's undefined or a null pointer), Elm's standard library defines a Maybe a type. Code that produces or handles an optional value does so explicitly using this type, and all other code is guaranteed a value of the claimed type is actually present.

Elm provides a limited number of built-in type classes: number which includes Int and Float to facilitate the use of numeric operators such as (+) or (*), comparable which includes numbers, characters, strings, lists of comparable things, and tuples of comparable things to facilitate the use of comparison operators, and appendable which includes strings and lists to facilitate concatenation with (++). Elm does not provide a mechanism to include custom types into these type classes or create new type classes (see Limits).

Module system

[edit]

Elm has a module system that allows users to break their code into smaller parts called modules. Modules can hide implementation details such as helper functions, and group related code together. Modules serve as a namespace for imported code, such as Bitwise.and. Third party libraries (or packages) consist of one or more modules, and are available from the Elm Public Library. All libraries are versioned according to semver, which is enforced by the compiler and other tools. That is, removing a function or changing its type can only be done in a major release.

Interoperability with HTML, CSS, and JavaScript

[edit]

Elm uses an abstraction called ports to communicate with JavaScript.[25] It allows values to flow in and out of Elm programs, making it possible to communicate between Elm and JavaScript.

Elm has a library called elm/html that a programmer can use to write HTML and CSS within Elm.[26] It uses a virtual DOM approach to make updates efficient.[27]

Backend

[edit]

Elm does not officially support server-side development. Czaplicki does consider it a primary goal at this point, but public progress on this front has been slow. Nevertheless, there are several independent projects which attempt to explore Elm on the backend.

The primary production-ready full-stack Elm platform is Lamdera, an open-core "unfork" of Elm.[28][29][30] Czaplicki has also teased Elm Studio, a potential alternative to Lamdera, but it isn't available to the public yet.[31] Current speculation is that Elm Studio will use a future version of Elm that targets C, uses Emscripten to compile to WASM, and supports type-safe Postgres table generation.[32][33]

For full-stack frameworks, as opposed to BaaS products, elm-pages is perhaps the most popular fully open-source option.[34] It does not extend the Elm language, but just runs the compiled JS on Node.js. It also supports scripting. There is also Pine, an Elm to .NET compiler, which allows safe interop with C#, F#, and other CLR languages.[35]

There were also some attempts in Elm versions prior to 0.19.0 to use the BEAM (Erlang virtual machine) to run Elm, but they are stuck due to the removal of native code in 0.19.0 and changes to the package manager. One of the projects executed Elm directly on the environment,[36] while another one compiled it to Elixir.[37]

Finally, the Gren programming language started out a fork of Elm primarily focused on backend support, although its goals have since shifted.

The Elm Architecture (TEA pattern)

[edit]

The Elm Architecture is a software design pattern and as a TLA called TEA pattern for building interactive web applications. Elm applications are naturally constructed in that way, but other projects may find the concept useful.

An Elm program is always split into three parts:

  • Model - the state of the application
  • View - a function that turns the model into HTML
  • Update - a function that updates the model based on messages

Those are the core of the Elm Architecture.

For example, imagine an application that displays a number and a button that increments the number when pressed.[38] In this case, all we need to store is one number, so our model can be as simple as type alias Model = Int. The view function would be defined with the Html library and display the number and button. For the number to be updated, we need to be able to send a message to the update function, which is done through a custom type such as type Msg = Increase. The Increase value is attached to the button defined in the view function such that when the button is clicked by a user, Increase is passed on to the update function, which can update the model by increasing the number.

In the Elm Architecture, sending messages to update is the only way to change the state. In more sophisticated applications, messages may come from various sources: user interaction, initialization of the model, internal calls from update, subscriptions to external events (window resize, system clock, JavaScript interop...) and URL changes and requests.

Limits

[edit]

Elm does not support higher-kinded polymorphism,[39] which related languages Haskell, Scala and PureScript offer, nor does Elm support the creation of type classes.

This means that, for example, Elm does not have a generic map function which works across multiple data structures such as List and Set. In Elm, such functions are typically invoked qualified by their module name, for example calling List.map and Set.map. In Haskell or PureScript, there would be only one function map. This is a known feature request that is on Czaplicki's rough roadmap since at least 2015.[40] On the other hand, implementations of TEA pattern in advanced languages like Scala does not suffer from such limitations and can benefit from Scala's type classes, type-level and kind-level programming constructs.[41]

Another outcome is a large amount of boilerplate code in medium to large size projects as illustrated by the author of "Elm in Action," a former Elm core team member, in his single page application example[42] with almost identical fragments being repeated in update, view, subscriptions, route parsing and building functions.

Example code

[edit]
-- This is a single line comment.

{-
This is a multi-line comment.
It is {- nestable. -}
-}

-- Here we define a value named `greeting`. The type is inferred as a `String`.
greeting =
    "Hello World!"

-- It is best to add type annotations to top-level declarations.
hello : String
hello =
    "Hi there."

-- Functions are declared the same way, with arguments following the function name.
add x y =
    x + y

-- Again, it is best to add type annotations.
hypotenuse : Float -> Float -> Float
hypotenuse a b =
    sqrt (a^2 + b^2)

-- We can create lambda functions with the `\[arg] -> [expression]` syntax.
hello : String -> String
hello = \s -> "Hi, " ++ s

-- Function declarations may have the anonymous parameter names denoted by `_`, 
-- which are matched but not used in the body. 
const : a -> b -> a
const k _ = k

-- Functions are also curried; here we've curried the multiplication 
-- infix operator with a `2`
multiplyBy2 : number -> number
multiplyBy2 =
    (*) 2

-- If-expressions are used to branch on `Bool` values
absoluteValue : number -> number
absoluteValue number =
    if number < 0 then negate number else number

-- Records are used to hold values with named fields
book : { title : String, author : String, pages : Int }
book =
    { title = "Steppenwolf"
    , author = "Hesse"
    , pages = 237 
    }

-- Record access is done with `.`
title : String
title =
    book.title

-- Record access `.` can also be used as a function
author : String
author =
    .author book

-- We can create tagged unions with the `type` keyword.
-- The following value represents a binary tree.
type Tree a
    = Empty
    | Node a (Tree a) (Tree a)

-- It is possible to inspect these types with case-expressions.
depth : Tree a -> Int
depth tree =
    case tree of
        Empty -> 0
        Node _ left right ->
            1 + max (depth left) (depth right)

See also

[edit]
  • PureScript – A strongly-typed, purely-functional programming language that compiles to JavaScript
  • Reason – A syntax extension and toolchain for OCaml that can also transpile to JavaScript

References

[edit]
  1. ^ Czaplicki, Evan (30 March 2012). "My Thesis is Finally Complete! "Elm: Concurrent FRP for functional GUIs"". Reddit.
  2. ^ "Releases: elm/Compiler". GitHub.
  3. ^ "elm/compiler". GitHub. 16 October 2021.
  4. ^ "Prior Art - Redux". redux.js.org. 28 April 2024.
  5. ^ "Shapes of errors to come". Rust Blog. Retrieved 2025-08-06. Those of you familiar with the Elm style may recognize that the updated --explain messages draw heavy inspiration from the Elm approach.
  6. ^ "Comparison with Other Frameworks — Vue.js".
  7. ^ "roc/roc-for-elm-programmers.md at main · roc-lang/roc". GitHub. Retrieved 2025-08-06. Roc is a direct descendant of the Elm programming language. The two languages are similar, but not the same!
  8. ^ "Why Derw: an Elm-like language that compiles to TypeScript?". 20 December 2021.
  9. ^ "Gren 0.1.0 is released".
  10. ^ "Elm home page".
  11. ^ "Elm: Concurrent FRP for Functional GUIs" (PDF).
  12. ^ "Try Elm". elm-lang.org. Retrieved 2025-08-06.
  13. ^ "elm and prezi". elm-lang.org.
  14. ^ "new adventures for elm". elm-lang.org.
  15. ^ "elm/compiler". GitHub. 16 October 2021.
  16. ^ "repl". elm-lang.org.
  17. ^ "package manager". elm-lang.org.
  18. ^ "Home". elm-lang.org.
  19. ^ "Install". guide.elm-lang.org.
  20. ^ "Elm packages". Elm-lang.org.
  21. ^ "Ellie". Ellie-app.com.
  22. ^ "syntax". elm-lang.org. Retrieved 2025-08-06.
  23. ^ "elm/core". package.elm-lang.org.
  24. ^ "Model The Problem". Elm. Retrieved 4 May 2016.
  25. ^ "JavaScript interop". elm-lang.org.
  26. ^ "elm/html". package.elm-lang.org.
  27. ^ "Blazing Fast HTML". elm-lang.org.
  28. ^ Elm Europe (2025-08-06). Mario Rogic - Elm as a Service. Retrieved 2025-08-06 – via YouTube.
  29. ^ Elm Online Meetup (2025-08-06). Building a Meetup clone on Lamdera - Martin Stewart. Retrieved 2025-08-06 – via YouTube.
  30. ^ "Episode 38: Lamdera". Elm Radio Podcast. Retrieved 2025-08-06.
  31. ^ "Elm Studio". www.elm.studio. Retrieved 2025-08-06.
  32. ^ "Status Update - 3 Nov 2021". Elm. 2025-08-06. Retrieved 2025-08-06.
  33. ^ Cesarini, Francesco (22 May 2023). "@evancz tempting the demo gods…". Twitter. Retrieved 26 March 2025.
  34. ^ "elm-pages - pull in typed elm data to your pages". elm-pages. Retrieved 2025-08-06.
  35. ^ "Pine — Run Elm Everywhere". pine-vm.org. Retrieved 2025-08-06.
  36. ^ "Kofigumbs/Elm-beam". GitHub. 24 September 2021.
  37. ^ "What is it?". GitHub. 24 September 2021.
  38. ^ "Buttons · An Introduction to Elm". guide.elm-lang.org. Retrieved 2025-08-06.
  39. ^ "Higher-Kinded types Not Expressible? #396". github.com/elm-lang/elm-compiler. Retrieved 6 March 2015.
  40. ^ "Higher-Kinded types Not Expressible #396". github.com/elm-lang/elm-compiler. Retrieved 19 November 2019.
  41. ^ "The Elm Architecture". tyrian.indigoengine.io. Retrieved 2025-08-06.
  42. ^ "Main.elm". github.com/rtfeldman/elm-spa-example. Retrieved 30 June 2020.
[edit]
耳鸣是什么原因引起的 冤亲债主是什么意思 人生感悟是什么意思 藏红花能治什么病 冰冻三尺非一日之寒是什么意思
肝钙化是什么意思 青霉素过敏不能吃什么药 什么地唱 监督是什么意思 月经不停吃什么药
念珠菌和霉菌有什么区别 为什么尿黄 缺血灶是什么意思 血小板压积偏低是什么意思 bpa是什么
头顶不舒服是什么原因 柔式按摩是什么意思 追随是什么意思 儿童早餐吃什么有营养还能长高 肝脂肪沉积是什么意思
一个月一个太念什么hcv8jop1ns1r.cn 乳晕是什么意思hcv7jop5ns6r.cn 什么红酒好喝hcv8jop0ns9r.cn 肝风内动吃什么中成药shenchushe.com 右肺中叶小结节是什么意思严重吗xianpinbao.com
梦见小女孩是什么意思hcv8jop1ns3r.cn 打不死的小强什么意思hcv8jop4ns8r.cn 干咳吃什么药止咳效果好hcv8jop4ns8r.cn 近水楼台先得月是什么生肖hcv8jop5ns3r.cn 眼睛为什么不怕冷hcv8jop2ns6r.cn
嗓子痛挂什么科hcv9jop2ns0r.cn 堆肥是什么意思hcv8jop7ns9r.cn 什么人什么己hcv7jop9ns0r.cn 吃凉的胃疼吃什么药hcv9jop3ns4r.cn 胎儿永存左上腔静脉是什么意思hcv8jop5ns3r.cn
藏红花泡水喝有什么功效hcv7jop5ns2r.cn 农历8月是什么月hcv9jop7ns1r.cn 意大利全称是什么hcv8jop7ns8r.cn 6月13号是什么星座hcv7jop7ns2r.cn 实质性是什么意思hcv8jop2ns2r.cn
百度