What does it mean to have a functor?

I am new to this and I may have something important. I read part 1 of Category Theory for programmers , but the most abstract math I did at university was group theory, so I need to read very slowly.

Ultimately, I would like to understand the theory in order to base my use of the techniques, so when I feel like I have made some progress, I go back to the fantasy land specification to test myself. This time I felt like I knew where to start: I started with Functor.

From the specification of fantasy land :

Functor

  • u.map(a => a)equivalently u(identity)
  • u.map(x => f(g(x)))equivalent u.map(g).map(f)(composition)

map method

map :: Functor f => f a ~> (a -> b) -> f b 

The value that the Functor has must be provided by the map method. The map method takes one argument:

u.map(f) 
  • f must be a function

    I am. If f is not a function, the behavior of the map is unspecified.

    ii.f can return any value.

    III. No parts of the return value of f should be checked.

  • map should return the value of the same Functor

I do not understand the phrase "the meaning that the functor has."

What does it mean to have a functor? I don’t think that “is a functor” or “belongs to a functor”, it will make sense here.

What is the documentation that is trying to say about u?


, ( ). , , , .

, a Functor a. - <

Functor :: a -> F a

, ,

map :: Functor f => (a -> b) -> f a -> f b

a , (a -> b) , a b. , "", , , "" ... , , . : , , " ".

- ; F a, F a. u , , "..." F a.

+4
1

, - , JavaScript , . , f a b. u f, a. u.map(f) F b, F a ( u) F b. map u.

JavaScript. ( , f .)

+1

Source: https://habr.com/ru/post/1689759/


All Articles