I'm Having problems understanding functors, specifically what a concrete type is in LYAH. I believe this is because I don't understand what [] really is.
fmap :: (a -> b) -> f a -> f b
- Is
[], a type-constructor? Or, is it a value constructor? - What does it mean to have the type of:
[] :: [a]? - Is it like
Maybetype-constructor, orJustvalue constructor?- If it is like
Justthen how comeJusthas a signature likeJust :: a -> Maybe arather thanJust :: Maybe a, in other words why isn't[]typed[] :: a -> [a]
- If it is like
- LYAH says this as it applies to functors: Notice how we didn't write instance Functor [a] where, because from fmap :: (a -> b) -> f a -> f b, we see that the f has to be a type constructor that takes one type. [a] is already a concrete type (of a list with any type inside it), while
[]is a type constructor that takes one type and can produce types such as [Int], [String] or even [[String]]. I'm confused though the type of[]implies it is like a literal for[a]what is LYAH trying to get at?