Skip to content

Commit fe9bba4

Browse files
committed
First draft
1 parent 3f81bef commit fe9bba4

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Status
2+
3+
📜 Proposed
4+
5+
# Context
6+
7+
# Proposed Design
8+
9+
## Top level exports
10+
11+
Each top level export should export distinct symbols.
12+
This may depend on the case, for example: `Cardano.Api.Byron` symbols which are still in use in current eras, can be reexported through `Cardano.Api`.
13+
14+
* `Cardano.Api` - everything domain related for the currently used and upcoming eras
15+
* `Cardano.Api.E` - everything for the obsoleted `E` era, for example `Cardano.Api.Byron`.
16+
1. Any symbol from era `E`, not in use in current era, should be exported through `Cardano.Api.E`.
17+
2. Any symbol from era `E` and still in use in current era, should be exported through `Cardano.Api` and additionally through `Cardano.Api.E`.
18+
If that's not possible to move it to a module under `Cardano.Api` module, the symbol should be copied to a module under `Cardano.Api`.
19+
* `Cardano.Api.U` utility module, related to `U` feature set like, like `Cardano.Api.Pretty`, `Cardano.Api.Monad.Error`.
20+
Those should **not** be reexported from `Cardano.Api`, because they would pollute symbol namespace, and are not required for using `cardano-api` core features but can be useful for the advanced users.
21+
1. Reexports from upstream libraries like consensus, network or ledger, also fall into this category e.g. `Cardano.Api.Ledger`.
22+
23+
Modules which are exposing general purpose classes and functions should go also into a separate module, and they not need to be reexported through `Cardano.Api`, for example:
24+
* `Cardano.Api.Tx.UTxO` - a wrapper type, with functions common to maps which would clash with other map data structures.
25+
A good example from Hackage is [`Data.Aeson.KeyMap`](https://hackage.haskell.org/package/aeson-2.2.3.0/docs/Data-Aeson-KeyMap.html).
26+
27+
28+
## Deeper level exports
29+
30+
Any other modules not meant to be a top level export, should be placed inside `Cardano.Api.Internal` and be reexported through a suitable top level module.
31+
In general `Cardano.Api.Internal.*` modules shouldn't be exposed in cabal package.
32+
This however depends on the specific use case.
33+
`Internal` in the module name should indicate that the module isn't really meant to be used directly, and users can expect more frequent breakage when relying on it.
34+
35+
* `Cardano.Api.Internal.X` should contain everything related to the domain `X`.
36+
For example `Cardano.Api.Address`.
37+
A good example from Hackage how to nest `Internal` modules is [`bytestring`](https://github.com/haskell/text/blob/master/src/Data/Text/Internal/Builder/RealFloat/Functions.hs) package.
38+
39+
# Decision
40+
41+
42+
# Consequences
43+

0 commit comments

Comments
 (0)