Skip to content

Commit 4ffec51

Browse files
authored
Merge pull request #7 from paldepind/minor-documentation-tweaks
Documentation tweaks
2 parents a0abb5a + 17f2112 commit 4ffec51

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

src/Effect/Uncurried.purs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
-- | This module defines types for effectful uncurried functions, as well as
22
-- | functions for converting back and forth between them.
33
-- |
4-
-- | Traditionally, it has been difficult to give a PureScript type to
5-
-- | JavaScript functions such as this one:
4+
-- | This makes it possible to give a PureScript type to JavaScript functions
5+
-- | such as this one:
66
-- |
77
-- | ```javascript
88
-- | function logMessage(level, message) {
@@ -14,10 +14,9 @@
1414
-- | receiving all of its parameters, so giving it the type `Data.Function.Fn2
1515
-- | String String Unit`, while convenient, would effectively be a lie.
1616
-- |
17-
-- | Because there has been no way of giving such functions types, we generally
18-
-- | resort to converting functions into the normal PureScript form (namely,
19-
-- | a curried function returning an Effect action), and performing the
20-
-- | marshalling in JavaScript, in the FFI module, like this:
17+
-- | One way to handle this would be to convert the function into the normal
18+
-- | PureScript form (namely, a curried function returning an Effect action),
19+
-- | and performing the marshalling in JavaScript, in the FFI module, like this:
2120
-- |
2221
-- | ```purescript
2322
-- | -- In the PureScript file:
@@ -64,9 +63,9 @@
6463
-- |
6564
-- | (note that this has the same type as the original `logMessage`).
6665
-- |
67-
-- | Effectively, we have reduced the risk of errors by moving as much code
68-
-- | into PureScript as possible, so that we can leverage the type system.
69-
-- | Hopefully, this is a little less tiresome too.
66+
-- | Effectively, we have reduced the risk of errors by moving as much code into
67+
-- | PureScript as possible, so that we can leverage the type system. Hopefully,
68+
-- | this is a little less tiresome too.
7069
-- |
7170
-- | Here's a slightly more advanced example. Here, because we are using
7271
-- | callbacks, we need to use `mkEffectFn{N}` as well.
@@ -121,13 +120,12 @@
121120
-- | The general naming scheme for functions and types in this module is as
122121
-- | follows:
123122
-- |
124-
-- | * `EffectFn{N}` means, a curried function which accepts N arguments and
125-
-- | performs some effects. The first type argument is the row of effects,
126-
-- | which works exactly the same way as in `Effect`. The last type argument
127-
-- | is the return type. All other arguments are the actual function's
128-
-- | arguments.
129-
-- | * `runEffectFn{N}` takes an `EffectFn` of N arguments, and converts it into the
130-
-- | normal PureScript form: a curried function which returns an Effect action.
123+
-- | * `EffectFn{N}` means, an uncurried function which accepts N arguments and
124+
-- | performs some effects. The first N arguments are the actual function's
125+
-- | argument. The last type argument is the return type.
126+
-- | * `runEffectFn{N}` takes an `EffectFn` of N arguments, and converts it into
127+
-- | the normal PureScript form: a curried function which returns an Effect
128+
-- | action.
131129
-- | * `mkEffectFn{N}` is the inverse of `runEffectFn{N}`. It can be useful for
132130
-- | callbacks.
133131
-- |

0 commit comments

Comments
 (0)