Functors Flashcards

1
Q

give the implementation of the Functor typeclass

A
class Functor f where  
    fmap :: (a -> b) -> f a -> f b
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what is the purpose of functors?

A

If a type is an instance of Functor, you can use fmap to apply a function to values in it. Another way of describing fmap is saying that it promotes functions to act on functorial values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

give the 1st functor law

A

fmap id = id

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

give the 2nd functor law

A

fmap (g . f) = fmap g . fmap f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly