The datatype of Lemonade
is as follows:
data Lemonade = Lemonade
{ lemonadeOrder :: Maybe OrderId
, lemonadeSize :: Size
, lemonadePrice :: Price
, lemonadeQty :: Qty
}
The lines that use pure provide values when processed, but don't
actually show any fields.
What this means is that when the form is displayed as HTML in the browser, the fields for which pure
has been used will not be shown. Although the value will be used internally, it won't be shown to the user. In your example, the fields for lemonadeOrder
and lemonadePrice
will not be shown up in the form.
What does the syntax <$>
and <*>
mean respectively?
<$>
is an alias for fmap
.
<*>
is used for Applicative style programming. You can get to know more about them by inspecting it's type and by reading Typeclassopedia or other relevant materials.