A teaser
A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute.
Система типов — это гибко управляемый синтаксический метод доказательства отсутствия в программе определенных видов поведения при помощи классификации выражений языка по разновидностям вычисляемых ими значений.
Types and Programming Languages
Benjamin C. Pierce
2002
© Cartesian Closed Comic
Still have to test though...
And prototyping can be painful.
data DisplayAccounts
= DisplaySingle AccountInfo
| DisplayMulti [AccountInfo]
Any namedtuple can be accidentally compared to any other with the same number of fields.
@dataclass
class InventoryItem:
'''Class for keeping track of an item in inventory.'''
name: str
unit_price: float
quantity_on_hand: int = 0
-- | Class for keeping track of an item in inventory.
data InventoryItem =
InventoryItem
{ name :: Text
, unitPrice :: Double
, quantityOnHand :: Int
}
jobs@serokell.io