findUser
returns User
authenticate
also returns User
User
AuthedUser
User[A <: AuthStatus]
Banned
at the type level!
A => Resource[F, B]
but I don’t have a value for A
yet. Can I transform that into Resource[F, A => B]
?
traverse
Resource
and Reader
F
is traversable
A => F[B]
and wanting A => B
IO
etc are not traversable)
F[A] => F[B]
starting from different arrows
map: (A => B) => (F[A] => F[B])
ap: F[A => B] => (F[A] => F[B])
flatMap: (A => F[B]) => (F[A] => F[B])
A => F[B]
is the essence of being monadic, i.e. context sensitivity, I can use the result of a computation to decide the shape of the next
A => F[B]
says: =>
means "depends on", so F
depends on A
(the next computation depends on the result)
F[A => B]
, A
cannot decide F
, since it doesn't even see it (it's on the outside, in F[A => B]
)