|
I'm not forcing any definition here. Just 5 is a map, and Nothing is a map. Let's watch: Just 5 >> Nothing Just is a map that accepts an input and returns that input decorated with a certain structure. Just ---(5)---> (Just 5)
Which means there's an arrow that shoots out of (Just), itself a map - because it has arrows coming in and going out - which we can use to arrive at (Just 5).Then (>>) combines the Just 5 map - a map that takes a function, like (>>) in this case, and returns another function that accepts another Maybe and returns another Maybe. Let's draw that: (Just 5) ---(>>)---> (\x -> (Just 5) >> x)
Which means there's an arrow that shoots out of (Just 5), itself a map, to which in this example we go to its index (>>) and retrieve the resulting value, another map: (\x -> (Just 5) >> x)Now we give the map above, the input Nothing, and it returns the value Nothing, itself a map, because it has arrows coming in and shooting out as can be seen below: (\x -> (Just 5) >> x) ---(Nothing)---.====(>>)====>> (\x -> Nothing >> x)
^ |
|________|
The ====> arrow above I've added to show other possible arrows you might want to take from Nothing onwards.In other words, to say that a value in Haskell is not a map is to say it can't be arrived at, nor escaped from. If I understand correctly, the only value that can't be escaped from is Bottom, which has 0 arrows pointing out of it. Therefore it is not a map. But Just, Just 5 and Nothing are all maps, as they all have arrows pointing to them (which means we can arrive at them) and arrows pointing out of them (which means we can escape from them). Something that has arrows coming in and going out, we call a morphism. |