Reputation: 1
I'm using a library called Monet.js, in the documentation has descriptions like this: Maybe[A].map(fn: A => B) : Maybe[B]
I dont know what represents the letters inside the brackets.
Anyone can help me ?
Upvotes: -2
Views: 49
Reputation: 815
Generic Types JavaScript doesn't have generic types but it's useful to know about them when dealing with Monads. For instance the List monad is a type that requires another type, such as a string or integer or some other type before it can be constructed. So you would have a List of Strings or a List of Integers or generically a List of As where A is a type you will supply. Now of course this is JavaScript and you can do as you please even though it doesn't make sense. But to make things clearer (hopefully) we will attempt to do show generics or type parameters thusly:
List[A]
Which means a List of As. Though of course you will have to keep track of the types yourself.
The documentation is in the monet.js readme.
Upvotes: 3