parent
349c3c6e66
commit
79e0790b2f
@ -1 +1,4 @@
|
|||||||
.idea*
|
.idea*
|
||||||
|
fenv
|
||||||
|
*.o
|
||||||
|
*.hi
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
-- Functor:
|
||||||
|
-- :t (replicate 3)
|
||||||
|
(replicate 3) :: a -> [a]
|
||||||
|
|
||||||
|
-- :t fmap (replicate 3)
|
||||||
|
(fmap (replicate 3)) :: f a -> f [a]
|
||||||
|
|
||||||
|
-- We say that (replicate 3) has been "lifted" to f
|
||||||
|
|
||||||
|
-- Also think of functors as things that output values.
|
||||||
|
-- fmap'ing a functor is attaching a modifier to the output(s) of the functor
|
||||||
|
-- partial applications of a function are themselves functors
|
||||||
|
-- fmap'ing these partial applications results in composition!
|
||||||
|
|
||||||
|
-- Applicative functors - Applicative class in Haskell
|
||||||
|
class (Functor f) => Applicative f where
|
||||||
|
pure :: a -> f a
|
||||||
|
(<*>) :: f (a -> b) -> (f a -> f b)
|
Loading…
Reference in new issue