Value constructors are functions that return a value of a data type. Because of this, just like any other function, they can take one or more parameters:
data Foo = Bar String Int | Biz String
Let's check the type of the Bar
value constructor.
:t Bar
prints
Bar :: String -> Int -> Foo
which proves that Bar
is indeed a function.
let x = Bar "Hello" 10
let y = Biz "Goodbye"