Let's look at the documentation of length function of String in Elm.
It's here and it looks like this.
length : String -> Int
> String.length "Hello World"
11 : Int
If we look at the similar feature in Ruby world then we get length method.
length -> integer
Method signature in ruby's documentation and Elm's documentation is quite similar. Both return an integer.
In Elm's world method definitions are called "Type Annotations". Going forward that's what I'm going to use in this blog.
Now let's look at method definition of slice method in Ruby.
It looks like this.
slice(start, length) -> new_str or nil
irb(main):006:0> "snakes on a plane!".slice(0,6)
=> "snakes"
In Elm world it looks like this.
slice : Int -> Int -> String -> String
> String.slice 0 6 "snakes on a plane!"
"snakes" : String
Questions is what's up with all those arrows.

Written byNeeraj Singh
Related blogs
- 01Benchmarking Crunchy Data for latencyOctober 15, 2024 · Vishnu M
- 02Improving NeetoRecord reach with Twitter player cardsAugust 16, 2024 · Bonnie Simon
- 03Honeybadger frontend integration in Neeto appsDecember 12, 2023 · Calvin Chiramal
- 04Deep Dive into Redis Data TypesNovember 14, 2023 · Sreeram Venkitesh