Haskell . #, #, *.
, , Integer, Bool, :
class Foo a where
foo :: a -> String
instance Foo Integer where
foo n = show (n+42)
instance Foo Bool where
foo b = if b then "Hello" else "Goodbye"
, , foo .
*Main> :t foo
foo :: Foo a => a -> String
, a, foo.
*Main> foo 1295
"1337"
*Main> foo False
"Goodbye"
, , .
*Main> foo "Hello"
<interactive>:1:1:
No instance for (Foo [Char])
arising from a use of `foo'
Possible fix: add an instance declaration for (Foo [Char])
In the expression: foo "Hello"
In an equation for `it': it = foo "Hello"
, , Haskell. , lcm .
*Main> :t lcm
lcm :: Integral a => a -> a -> a
, , Integral. , Int, Int, Integer , Int32, Int64 ..
foldl1' lcm, , , .
* -, , . . , , #. ; Monad - , , .