Haskell, OO, . , , , , "", Haskell. , DRY ( , OO), , - , .
-- deriving (...) clauses and other boilerplate omitted for brevity
data Shape = Triangle | Quad | Pentagon | Other
data MyRecord = MyRecord Int
numSides :: Shape -> Int
numSides Triangle = 3
numSides Quad = 4
numSides Pentagon = 5
numSides Other = 0
shape :: Int -> Shape
shape 3 = Triangle
shape 4 = Quad
shape 5 = Pentagon
shape _ = Other
makeMyRecord :: Shape -> MyRecord
makeMyRecord = MyRecord . numSides
numberOfSides :: MyRecord -> Int
numberOfSides (MyRecord x) = x
shapeOf :: MyRecord -> Shape
shapeOf = shape . numberOfSides
Shape Enum Bounded, . Shape numSides Enum. MyRecord Int, , makeMyRecord', . , DRY, , "" .