I'm trying to understand what the following type synonym from Yesod is doing.
type HtmlUrlI18n msg url = Translate msg -> Render url -> Html
I could not find an example in learn you some haskell or the haskell wikibook of a type synonym with ->
present. Any links or explanations are much appreciated. Thanks.
HtmlUrlI18n msg url
, replace that withTranslate msg -> Render url -> Html
.Translate msg -> Render url -> Html
as one of many arguments. That quickly gets unreadable and perhaps unclear, whereas having it take aHtmlUrlI18n msg url
is much better.->
is different from, for example,Either
only by its infix position. TypeTranslate msg -> Render url -> Html
is equivalent to(->) (Translate msg) ((->) (Render url) Html)
. By the way, you can define your own infix types.