In en haskell

Ejemplos de código

1
0

funtor de haskell

-- Functors are a class of data structure that "contain" a generic type
-- you can "inject" functions inside these functors with `fmap`

-- Applying a function "inside" of a functor will not change the structure
-- of the functor
-- e.g `fmap (\x -> x + 1)` [1..10] will not change the length of the list

-- Functors require an implentation of `fmap`
fmap :: Functor f => (a -> b) -> f a -> f b

-- and have to obey the functor laws:
-- fmap id = id
-- fmap (f . g) = fmap f . fmap g
0
0

in en haskell

take 1 $ filter even [1..10] 
-- = [2]

-- Same with:
take 1 (filter even [1..10])

Páginas relacionadas

Páginas de ejemplo relacionadas

En otros idiomas

Esta página está en otros idiomas

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................