---
title: "Arrows in Elm's method signature"
description: "Arrows in Elm's method signature"
canonical_url: "https://www.bigbinary.com/blog/arrows-in-method-signature-of-elm"
markdown_url: "https://www.bigbinary.com/blog/arrows-in-method-signature-of-elm.md"
---

# Arrows in Elm's method signature

Arrows in Elm's method signature

- Author: Neeraj Singh
- Published: July 11, 2017
- Categories: Misc

Let's look at the documentation of `length` function of `String` in Elm.

It's
[here](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/String#length)
and it looks like this.

```elm
length : String -> Int

> String.length "Hello World"
11 : Int
```

If we look at the similar feature in Ruby world then we get
[length](https://ruby-doc.org/core-2.2.0/String.html#method-i-length) method.

```ruby
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](https://ruby-doc.org/core-2.2.0/String.html#slice-method).

```ruby
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](http://package.elm-lang.org/packages/elm-lang/core/5.1.1/String#slice).

```ruby
slice : Int -> Int -> String -> String

> String.slice  0  6 "snakes on a plane!"
"snakes" : String
```

Questions is what's up with all those arrows.

## Links

- [Human page](https://www.bigbinary.com/blog/arrows-in-method-signature-of-elm)
