mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-14 02:34:17 +02:00
Translate type signatures
This commit is contained in:
@@ -220,24 +220,26 @@ even . fib $ 7 -- false
|
|||||||
|
|
||||||
|
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
-- 5. Type signatures
|
-- 5. Sygnatury typów
|
||||||
----------------------------------------------------
|
----------------------------------------------------
|
||||||
|
|
||||||
-- Haskell has a very strong type system, and every valid expression has a type.
|
-- Haskell posiada wyjątkowo silny system typów, w którym każde poprawne
|
||||||
|
-- wyrażenie ma swój typ.
|
||||||
|
|
||||||
-- Some basic types:
|
-- Kilka podstawowych typów:
|
||||||
5 :: Integer
|
5 :: Integer
|
||||||
"hello" :: String
|
"hello" :: String
|
||||||
True :: Bool
|
True :: Bool
|
||||||
|
|
||||||
-- Functions have types too.
|
-- Funkcje też są określonego typu.
|
||||||
-- `not` takes a boolean and returns a boolean:
|
-- `not` przyjmuje wartość logiczną i taką też zwraca:
|
||||||
-- not :: Bool -> Bool
|
-- not :: Bool -> Bool
|
||||||
|
|
||||||
-- Here's a function that takes two arguments:
|
-- Przykład funkcji przyjmującej dwa argumenty
|
||||||
-- add :: Integer -> Integer -> Integer
|
-- add :: Integer -> Integer -> Integer
|
||||||
|
|
||||||
-- When you define a value, it's good practice to write its type above it:
|
-- Dobrą praktyką podczas definiowania wartości jest napisanie nad nią
|
||||||
|
-- także jej typu:
|
||||||
double :: Integer -> Integer
|
double :: Integer -> Integer
|
||||||
double x = x * 2
|
double x = x * 2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user