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.
Its just a synonym for a (long to write down) function type. For example, the following should be valid Haskell
--Example of a function type synonym
type StrFn = String -> String
foo :: StrFn
foo s = s ++ "!"
--Example of a function type synonym with type parameters
type Fn a = a -> a
bar :: Fn String
bar s = s ++ "?"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With