Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

20 lignes
674 B

  1. And now we are going to write functions to use it:
  2. \begin{haskellcode}
  3. isListEmpty :: List t -> Bool
  4. isListEmpty Emtpy = True
  5. isListEmpty x = False
  6. \end{haskellcode}
  7. \pause
  8. We can even have more generic stuff like:
  9. \begin{haskellcode}
  10. f :: a -> b
  11. \end{haskellcode}
  12. Whatever the function does... it gets something of one type and returns something of another type (it could be the same type, but doesn't need to). That's all we know.
  13. \vspace{\baselineskip}
  14. \\
  15. \pause
  16. Similarly, remember the function \hinline{head} which gives us the first element of a list? The type signature actually looks like this:
  17. \begin{haskellcode}
  18. head :: [a] -> a
  19. \end{haskellcode}
  20. Makes sense?