(also ReaderT in ocaml is pretty interesting)
(also ReaderT in ocaml is pretty interesting)
ironically it's what made me understood ReaderT over IO back then
ironically it's what made me understood ReaderT over IO back then
paullouth.com/higher-kinds...
paullouth.com/higher-kinds...
but that makes it an implicit parameter, not a global variable
but that makes it an implicit parameter, not a global variable
hackage.haskell.org/package/effe...
hackage.haskell.org/package/effe...
fmap f ReaderT ( g ) = (\x -> fmap f (g x))
join ReaderT ( g ) = (\x -> join (fmap ($ x) g x))
x >>= f = join (fmap f x)
which is uhhhh
...eve more complicated lol
fmap f ReaderT ( g ) = (\x -> fmap f (g x))
join ReaderT ( g ) = (\x -> join (fmap ($ x) g x))
x >>= f = join (fmap f x)
which is uhhhh
...eve more complicated lol
paullouth.com/higher-kinds...
paullouth.com/higher-kinds...
ReaderT r m a, you use it with runReaderT :: r -> m a
and like
ReaderT is literally just a record with runReaderT as its only member
its just a r -> m a
ReaderT r m a, you use it with runReaderT :: r -> m a
and like
ReaderT is literally just a record with runReaderT as its only member
its just a r -> m a
1) the problem with global variables is that they're mutable (immutable global variables are just... definitions) but ReaderT is not
2) the way that problem manifests is that any *usages* of the variable are inherently coupled (that's the global bit)
1) the problem with global variables is that they're mutable (immutable global variables are just... definitions) but ReaderT is not
2) the way that problem manifests is that any *usages* of the variable are inherently coupled (that's the global bit)
ReaderT has none of those issues because it's *not* global. it is scoped to the usage (i.e. the runReaderT call)
ReaderT has none of those issues because it's *not* global. it is scoped to the usage (i.e. the runReaderT call)
The state monad is therefore just a composition of a writer and a reader, s -> (s, a), ReaderT s (Writer s) a
The state monad is therefore just a composition of a writer and a reader, s -> (s, a), ReaderT s (Writer s) a
#Scala
I also feel for whoever has to pick up my code that’s chock full of the crocks library. Like I’m sure there are 5 other devs that do JS this way, using Async, ReaderT, Maybe, Either.
This is why I have to run my own company, so I can do things this terrible way 🤭
I also feel for whoever has to pick up my code that’s chock full of the crocks library. Like I’m sure there are 5 other devs that do JS this way, using Async, ReaderT, Maybe, Either.
This is why I have to run my own company, so I can do things this terrible way 🤭