forked from orion/obsidian
18 lines
445 B
Markdown
18 lines
445 B
Markdown
Adds the `pure` [[Functions|function]] to [[Apply]], allowing arbitrary values to be wrapped in a [[Functor]].
|
|
|
|
```haskell
|
|
class Apply f <= Applicative f where
|
|
pure :: forall a. a -> f a
|
|
```
|
|
|
|
### Examples
|
|
`pure a` in various types:
|
|
|
|
type|equivalent to
|
|
---|---
|
|
[[Array]]|`[a]`
|
|
[[List]]|`Cons a`
|
|
[[Maybe]]|`Just a`
|
|
[[Either]]|`Right a`
|
|
[[Effect]]|`() => a`<sup><i>more or less</i></sup>
|
|
[[Aff]]|`Promise.resolve(a)`<sup><i>more or less</i></sup> |