Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pp:2024:l10 [2024/05/09 17:00] mihai.udubasa |
pp:2024:l10 [2024/05/13 16:12] (current) mihai.udubasa |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Lab 10. Algebraic Data Types ====== | ====== Lab 10. Algebraic Data Types ====== | ||
- | Types are an essential component in haskell. They start with capital letters, like ''Int''. We have multiple ways of customizing data types. | + | Types are an essential component in Haskell. They start with capital letters, like ''Int''. We have multiple ways of customizing data types. |
===== Type Aliases ===== | ===== Type Aliases ===== | ||
Line 11: | Line 11: | ||
type Name = String | type Name = String | ||
type PhoneNumber = String | type PhoneNumber = String | ||
- | PhoneBook = Map Name PhoneNumber | + | type PhoneBook = Map Name PhoneNumber |
</code> | </code> | ||
Line 129: | Line 129: | ||
- | After the lab, you can take a look at some more cool stuff related to data types in haskell and functional types in general: | + | After the lab, you can take a look at some more cool stuff related to data types in Haskell and functional types in general: |
[[https://wiki.haskell.org/Unboxed_type|Unboxed types]] | [[https://wiki.haskell.org/Unboxed_type|Unboxed types]] | ||
Line 182: | Line 182: | ||
instance Ord Player where | instance Ord Player where | ||
(<=) = ??? | (<=) = ??? | ||
- | -- haskell can infer implementations for all other operations if the implementation for (<=) is given. | + | -- Haskell can infer implementations for all other operations if the implementation for (<=) is given. |
</code> | </code> | ||