title: Why the return of this Haskell function is different from the return of the function defined?
body: <p>I'm reading this simple <a href="https://docs.servant.dev/en/stable/tutorial/ApiType.html" rel="nofollow noreferrer">servant tutorial</a> to learn haskell. Here's the code:</p>
  <pre><code>type UserAPI1 = &quot;users&quot; :&gt; Get '[JSON] [User]
  
  data User = User
    { name :: String
    , age :: Int
    , email :: String
    , registration_date :: Day
    } deriving (Eq, Show, Generic)
  
  instance ToJSON User
  
  users1 :: [User]
  users1 =
    [ User &quot;Isaac Newton&quot;    372 &quot;isaac@newton.co.uk&quot; (fromGregorian 1683  3 1)
    , User &quot;Albert Einstein&quot; 136 &quot;ae@mc2.org&quot;         (fromGregorian 1905 12 1)
    ]
  
  server1 :: Server UserAPI1
  server1 = return users1
  </code></pre>
  <p>If <code>server1 :: Server UserAPI1</code>, then <code>return users1</code> should be a function that when applied, returned the type <code>Server UserAPI1</code>. But it's actually a function that returns <code>[User]</code>. I'm confused. Why the function return type is different from the return type of the function defined?</p>