I have to give a (simple) talk about Yesod. And yes,.. i've never or really really rarely used haskell as well. University lecturer.....huh.
So i read a book about yesod and in some chapters the author is using some operators like <$>
and <*>
.
Can someone explain in easy words, what this operators do? Its pretty hard to google for that chars and if tried to read the documentation of Control.Applicative but to be honest, its hard to get for an haskell beginner.
so i hope anyone have a simple answer for me :)
an example of the book where these operators are used:
......
personForm :: Html -> MForm Handler (FormResult Person, Widget)
personForm = renderDivs $ Person
<$> areq textField "Name" Nothing
<*> areq (jqueryDayField def
{ jdsChangeYear = True -- give a year dropdown
, jdsYearRange = "1900:-5" -- 1900 till five years ago
}) "Birthday" Nothing
<*> aopt textField "Favorite color" Nothing
<*> areq emailField "Email address" Nothing
<*> aopt urlField "Website" Nothing
data Person = Person
{ personName :: Text
, personBirthday :: Day
, personFavoriteColor :: Maybe Text
, personEmail :: Text
, personWebsite :: Maybe Text
}
deriving Show
.....
.....................................
Hey,
Thanks a lot and amazingly most of the answers are useful. Sadly a only can hit "solved" on one answer. Thanks a lot, the tutorial (that I really didn't find on Google) is pretty good