Do we have a standard name for (r: Reader<R,A>) => A?
(r: Reader<R,A>) => A
import { Reader } from 'fp-ts/lib/Reader'; type Provider<R> = <A>(r: Reader<R,A>) => A type Name = string type Age = number type Customer = { name: Name, age: Age, } const john: Provider<Customer> = (r) => r({ name: 'John Doe', age: 42, }) const getAge: Reader<Customer, Age> = ({age}) => age const ageJohn: Age = john(getAge);
Yoneda? Provider<R> is isomorphic to R
Provider<R>
R
Whoops, my brain is starting to melt, but I like all of this. :)
Wait, wait, I get it now
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Do we have a standard name for
(r: Reader<R,A>) => A
?Yoneda?
Provider<R>
is isomorphic toR
Whoops, my brain is starting to melt, but I like all of this. :)
Wait, wait, I get it now