Basics
Defining functions
Scala
``def triple(x: Int): Int = 3 * x``
``````triple :: Int -> Int
triple x = 3 * x``````

``triple :: Int -> Int; triple x = 3 * x``

Many tutorials use `let triple :: ...`. There's no difference between those two notations in GHCi so it's up to you to decide .

``````:{
triple :: Int -> Int
triple x = 3 * x
:}
``````

Note the `:{` and `:}` in the first and last line. Besides of that it's the same as one would define the function in a source file.

???
Scala
``def compute: Int = ???``
``````compute :: Int
compute = undefined
``````

Function composition (andThen style)
Scala
``````// Given:
val toInt: String => Int = Integer.parseInt
val triple: Int => Int = x => 3 * x

// You can compose them:
(toInt andThen triple)("5")
// res: 15
``````
``````-- Given:
toInt  :: String -> Int; toInt  x = read x
triple :: Int    -> Int; triple x = 3 * x

-- You can compose them:
import Control.Arrow
(toInt >>> triple) "5"
-- res: 15
``````

Function composition (compose style)
Scala
``````> (triple compose toInt)("5")
// res: 15
``````
``````> (triple . toInt) "5"