Answers for "haskell"

1

haskell functor

-- 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
Posted by: Guest on December-06-2020
1

haskell

Elegi otro lenguaje! Haskell es horrible
Posted by: Guest on October-03-2021

Browse Popular Code Answers by Language