Hi, I know that there are names for specific funct...
# getting-started
a
Hi, I know that there are names for specific functions, like a function with an argument that returns a Boolean is a Predicate, but is there a name for a function that has an argument of type T and returns the same type ? Like this
typealias IDK<T> = (value: T) -> T
r
It's not really named based on the types, but more on the expected use. For example, it's not a predicate because it returns a Boolean, it's a predicate because it's a statement about the information passed in. A predicate could take multiple arguments (and depending on the domain could theoretically return something other than a Boolean, though that's more rare and domain specific), and a function that returns a Boolean may not nesessarily be a predicate. So, to answer your question, how to name your alias depends on it's expected use. As @Landry Norris said, transform[ation] and mutator make sense when you're respectively transforming or mutating the value, but if you have no information about the use, your best bet would probably just be "function" or a synonym (operation, action, etc.).
v
ThingDoer
🙂
👍 1
😆 3
n
l
A monad
🧌 3
y
@Ludovik b-but but it's not a monoid in the category of endofunctors!!!!!!!!!!!!!!!
v
Better Monad than Maenad
a
Thanks for the help everyone !