Haskell类型的同义词

Dav*_*vid 5 haskell yesod

我试图理解Yesod的以下类型同义词正在做什么.

type HtmlUrlI18n msg url = Translate msg -> Render url -> Html

我找不到一个例子来了解你的一些haskell或haskell wikibook的类型同义词与->present.任何链接或解释都非常感谢.谢谢.

hug*_*omg 4

它只是(很长的)函数类型的同义词。例如,以下内容应该是有效的 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 ++ "?"
Run Code Online (Sandbox Code Playgroud)