Herramientas de usuario

Herramientas del sitio


wiki2:elm-code

¡Esta es una revisión vieja del documento!


Elm Code

Elm patterns

Gotchas

Wrap\Unwrap

type Dollar = Dollar Float

priceInEuros: Dollar -> Float
priceInEuros (Dollar d) = d * 1.1

priceInEuros 3.3  -- 3.63

Function composition (?)

Every function that accepts two arguments can be converted in one that accepts one argument:

> String.repeat
<function> : Int -> String -> String

> String.repeat 4
<function> : String -> String

Simplify types

type alias MyType = Int → String → String mytrial: MyType mytrial n s = String.repeat n s mytrial 3 “abc”

wiki2/elm-code.1608902975.txt.gz · Última modificación: 2020/12/25 14:29 (editor externo)