@@ -1044,17 +1044,17 @@ If we have a function that gets us from an `m a` to an `n a`, for any `a`, what
10441044do we have?
10451045
10461046``` haskell ignore
1047−newtype m :~> n = Nat { unNat :: forall a. m a -> n a}
1047+newtype m :~> n = NT { ($$) :: forall a. m a -> n a}
10481048```
10491049
10501050For example:
10511051
10521052``` haskell
1053−listToMaybeNat :: [] :~> Maybe
1054−listToMaybeNat = Nat listToMaybe -- from Data.Maybe
1053+listToMaybeNT :: [] :~> Maybe
1054+listToMaybeNT = NT listToMaybe -- from Data.Maybe
10551055```
10561056
1057−(`Nat` comes from "natural transformation", in case you're wondering.)
1057+(`NT` comes from "natural transformation", in case you're wondering.)
10581058
10591059So if you want to write handlers using another monad/type than `Handler`, say the `Reader String` monad, the first thing you have to
10601060prepare is a function:
@@ -1066,14 +1066,14 @@ readerToHandler :: Reader String :~> Handler
10661066Let's start with `readerToHandler'`. We obviously have to run the `Reader`
10671067computation by supplying it with a `String`, like `"hi"`. We get an `a` out
10681068from that and can then just `return` it into `ExceptT`. We can then just wrap
1069−that function with the `Nat` constructor to make it have the fancier type.
1069+that function with the `NT` constructor to make it have the fancier type.
10701070
10711071``` haskell
10721072readerToHandler' :: forall a. Reader String a -> Handler a
10731073readerToHandler' r = return (runReader r "hi")
10741074
10751075readerToHandler :: Reader String :~> Handler
1076−readerToHandler = Nat readerToHandler'
1076+readerToHandler = NT readerToHandler'
10771077```
10781078
10791079We can write some simple webservice with the handlers running in `Reader String`.