I'm a math PhD student minoring in CS and currently taking a class in Haskell. We just learned about liftM
.
The concepts seem similar but I haven't been able to figure out exactly how liftM
can be thought of as a lift in the category-theoretical sense (I know very little category theory and was introduced to lifts in a Topology class).
Given a map from a space to a space and another map from a space to a space , a lift is a map from to such that . In other words, a lift of is a map. such that the diagram (shown below) commutes.
A lifting function's role is to lift a function into a context (typically a Functor or Monad). So lifting a function of type a -> b into a List context would result in a function of type List[a] -> List[b] .
Given the lack of activity -- and the lack of an obvious connection -- I think it's safe to say that liftM
was not named because of its connection to topological and category-theoretic lifts.
Instead, I think the term "lift" has come to generically mean any transformation from one domain of reasoning to another, and it is this sense of "lift" that was the historical reason for the name liftM
. Specifically: liftM
transforms a pure function, "lift"ing it into the domain of a specific monad.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With