在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):eeue56/haskell-to-elm开源软件地址(OpenSource Url):https://github.com/eeue56/haskell-to-elm开源编程语言(OpenSource Language):开源软件介绍(OpenSource Introduction):haskell-to-elmCollection of examples on places where Elm is different to Haskell. Used for helping beginners moving from Haskell to Elm. Non-exhaustive list, only to be used alongside the documentation on the Elm site. Functional programmingType signaturesElm uses a single colon Example
becomes
Function applicationInstead of using the dollar symbol Example:
becomes
Function compositionInstead of using the Example:
becomes
List comprenhensionsThere are no list comprehensions in Elm. LensesElm has the package focus for lense-like accessors. Due to a lack of template-haskell like functionality, you must always manually create your own focus Example:
becomes
where vs letElm has no where binding - instead use let Pattern matchingElm doesn't support multiple body declarations for functions, so instead you have to use case..of Example:
becomes
PurityFunctions in Elm as of 0.15.1 have pure type signatures. However, as they are actually implented in JS, it's possible that the underlying code you're calling isn't pure. This gives the effect of Elm the language being pure, but the things it can be used to do can be impure (eg, drawing to screen). Native functions can also produce runtime errors, though there is a drive to rid these from Elm entirely. Built-in (Prelude) methodsidElm has renamed id to identity Example:
becomes
consElm uses double colons Example
becomes
headInstead of throwing errors for empty lists, Elm uses Maybe for head Example
becomes
tailInstead of throwing errors for empty lists, Elm uses Maybe for tail Example
becomes
zipElm has no built-in zip method - instead it provides a map2 function that can be used with the tuple creator Example:
becomes
showElm renamed show to toString. Confusingly, there is also a method called show in Elm - this generates a HTML element containing a textual representation of the data. Example:
becomes
modmod in Elm uses the Example:
becomes
unwordsunwords is replaced by the join function Example:
becomes
cycleElm has no cycle built in. TODO: find documentation for this foldlThe order of the accumalator function arguments are swapped in Elm. Example:
becomes
Module syntaxImporting namesElm uses the Example:
becomes
Defining exportable namesTODO: find documentation on elm site for this Following the module declaration, you must have no identnation level. Example:
becomes
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论