A coworker and I were discussing RankNTypes
and why the extension is used in lens
. RankNTypes
has confused me for a while, but making the connection to lens
gave me a good intuition (strangely?). Here’s a recap in case it’s useful to anyone else:
If you have a normal higher-order function:
foo :: Num a => (a -> a) -> a
foo f = f 1
We can pass foo
any function that fits the (a -> a)
with a Num
constraint: