Skip to content

Replace 'id' with 'identity' in documentation #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,23 @@ Along with these types, you'll want to define an options record that specifies h
options ∷ Record (URIRefOptions UserInfo (HostPortPair Host Port) Path HierPath RelPath Query Fragment)
options =
{ parseUserInfo: pure
, printUserInfo: id
, printUserInfo: identity
, parseHosts: HostPortPair.parser pure pure
, printHosts: HostPortPair.print id id
, printHosts: HostPortPair.print identity identity
, parsePath: pure
, printPath: id
, printPath: identity
, parseHierPath: pure
, printHierPath: id
, printHierPath: identity
, parseRelPath: pure
, printRelPath: id
, printRelPath: identity
, parseQuery: pure
, printQuery: id
, printQuery: identity
, parseFragment: pure
, printFragment: id
, printFragment: identity
}
```

As you can see by all the `pure` and `id`, we're not doing a whole lot here. `parseHosts` is a bit of an exception, but that's just due to the way that case is handled (see [later in this README](#host-parsing) for more details about that).
As you can see by all the `pure` and `identity`, we're not doing a whole lot here. `parseHosts` is a bit of an exception, but that's just due to the way that case is handled (see [later in this README](#host-parsing) for more details about that).

These types ([`UserInfo`][UserInfo], [`HostPortPair`][HostPortPair], [`Host`][Host], etc.) are all provided by the library, and where necessary can only be constructed via smart constructor. This ensures that percent-encoding is applied to characters where necessary to ensure the constructed values will print as valid URIs, and so on.

Expand Down
4 changes: 2 additions & 2 deletions src/URI/AbsoluteURI.purs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ type AbsoluteURIParseOptions userInfo hosts path hierPath query r =
-- | when type anotating an options record.
-- |
-- | As a reverse of the parse options, this specifies how to print values back
-- | from custom representations. If this is not necessary, `id` can be used for
-- | from custom representations. If this is not necessary, `identity` can be used for
-- | all the options aside from `printHosts`, which will typically be
-- | `HostPortPair.printHosts id id`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | `HostPortPair.printHosts identity identity`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | for more information on the host/port pair printer.
type AbsoluteURIPrintOptions userInfo hosts path hierPath query r =
( printUserInfo ∷ userInfo → UserInfo
Expand Down
2 changes: 1 addition & 1 deletion src/URI/Extra/MultiHostPortPair.purs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ parseRegName' = RegName.unsafeFromString <<< NES.join1With "" <$> NEA.some p
-- |
-- | As a counterpart to the `parser` this function also requires the `Host`
-- | and `Port` components to be printed back from their custom representations.
-- | If no custom types are being used, pass `id` for both of these arguments.
-- | If no custom types are being used, pass `identity` for both of these arguments.
print
∷ ∀ host port
. (host → Host)
Expand Down
2 changes: 1 addition & 1 deletion src/URI/Extra/QueryPairs.purs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ parsePart parseK parseV = do
-- |
-- | As a counterpart to the `parser` this function also requires the `Key`
-- | and `Value` components to be printed back from their custom representations.
-- | If no custom types are being used, pass `id` for both of these arguments.
-- | If no custom types are being used, pass `identity` for both of these arguments.
print
∷ ∀ k v
. (k → Key)
Expand Down
2 changes: 1 addition & 1 deletion src/URI/HostPortPair.purs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ parser parseHost parsePort = do
-- |
-- | As a counterpart to the `parser` this function also requires the `Host`
-- | and `Port` components to be printed back from their custom representations.
-- | If no custom types are being used, pass `id` for both of these arguments.
-- | If no custom types are being used, pass `identity` for both of these arguments.
print
∷ ∀ host port
. (host → Host)
Expand Down
4 changes: 2 additions & 2 deletions src/URI/RelativeRef.purs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ type RelativeRefParseOptions userInfo hosts path relPath query fragment r =
-- | printer.
-- |
-- | As a reverse of the parse options, this specifies how to print values back
-- | from custom representations. If this is not necessary, `id` can be used for
-- | from custom representations. If this is not necessary, `identity` can be used for
-- | all the options aside from `printHosts`, which will typically be
-- | `HostPortPair.printHosts id id`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | `HostPortPair.printHosts identity identity`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | for more information on the host/port pair printer.
type RelativeRefPrintOptions userInfo hosts path relPath query fragment r =
( printUserInfo ∷ userInfo → UserInfo
Expand Down
4 changes: 2 additions & 2 deletions src/URI/URI.purs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ type URIParseOptions userInfo hosts path hierPath query fragment r =
-- | when type anotating an options record.
-- |
-- | As a reverse of the parse options, this specifies how to print values back
-- | from custom representations. If this is not necessary, `id` can be used for
-- | from custom representations. If this is not necessary, `identity` can be used for
-- | all the options aside from `printHosts`, which will typically be
-- | `HostPortPair.printHosts id id`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | `HostPortPair.printHosts identity identity`. See [`URI.HostPortPair`](../URI.HostPortPair)
-- | for more information on the host/port pair printer.
type URIPrintOptions userInfo hosts path hierPath query fragment r =
( printUserInfo ∷ userInfo → UserInfo
Expand Down