new element haskell code example
Example 1: first element in list haskell
list = [1, 2, 3]
head :: [a] -> a
head (x:_) = x
head list -- 1
Example 2: remove first element list haskell
a = [1, 2, 3, 4]
b = tail a
-- b == [2, 3, 4]
list = [1, 2, 3]
head :: [a] -> a
head (x:_) = x
head list -- 1
a = [1, 2, 3, 4]
b = tail a
-- b == [2, 3, 4]