Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Revise Constructors (#451)
Browse files Browse the repository at this point in the history
Co-authored-by: Tim <hello@timsmart.co>
  • Loading branch information
mikearnaldi and tim-smart committed Aug 31, 2023
1 parent 41ddfb7 commit a9f8319
Show file tree
Hide file tree
Showing 100 changed files with 2,237 additions and 3,087 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-camels-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/data": minor
---

Revise Constructors and improve Module Structure
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
15 changes: 1 addition & 14 deletions docs/modules/Brand.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ Added in v1.0.0
- [EnsureCommonBase (type alias)](#ensurecommonbase-type-alias)
- [FromConstructor (type alias)](#fromconstructor-type-alias)
- [Unbranded (type alias)](#unbranded-type-alias)
- [UnionToIntersection (type alias)](#uniontointersection-type-alias)

---

Expand Down Expand Up @@ -334,7 +333,7 @@ A utility type to extract the brands from a branded type.

```ts
export type Brands<P> = P extends Brand<any>
? Brand.UnionToIntersection<
? Types.UnionToIntersection<
{
[k in keyof P[BrandTypeId]]: k extends string | symbol ? Brand<k> : never
}[keyof P[BrandTypeId]]
Expand Down Expand Up @@ -387,15 +386,3 @@ export type Unbranded<P> = P extends infer Q & Brands<P> ? Q : P
```
Added in v1.0.0
### UnionToIntersection (type alias)
A utility type that transforms a union type `T` into an intersection type.
**Signature**
```ts
export type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never
```
Added in v1.0.0
8 changes: 4 additions & 4 deletions docs/modules/Chunk.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -1002,11 +1002,11 @@ Added in v1.0.0
**Signature**

```ts
export interface Chunk<A> extends Iterable<A>, Equal.Equal, Pipeable {
readonly _id: TypeId

export interface Chunk<A> extends Iterable<A>, Equal.Equal, Pipeable, Inspectable {
readonly [TypeId]: {
readonly _A: (_: never) => A
}
readonly length: number

/** @internal */
right: Chunk<A>
/** @internal */
Expand Down
30 changes: 23 additions & 7 deletions docs/modules/Context.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Added in v1.0.0
- [Tag](#tag)
- [empty](#empty)
- [make](#make)
- [unsafeMake](#unsafemake)
- [getters](#getters)
- [get](#get)
- [getOption](#getoption)
Expand Down Expand Up @@ -65,7 +66,7 @@ desireable to preserve the instance across reloads.
**Signature**

```ts
export declare const Tag: <Identifier, Service = Identifier>(key?: unknown) => Tag<Identifier, Service>
export declare const Tag: <Identifier, Service = Identifier>(identifier?: unknown) => Tag<Identifier, Service>
```

**Example**
Expand Down Expand Up @@ -123,6 +124,16 @@ assert.deepStrictEqual(Context.get(Services, Port), { PORT: 8080 })

Added in v1.0.0

## unsafeMake

**Signature**

```ts
export declare const unsafeMake: <Services>(unsafeMap: Map<Tag<any, any>, any>) => Context<Services>
```

Added in v1.0.0

# getters

## get
Expand Down Expand Up @@ -234,10 +245,10 @@ Added in v1.0.0
**Signature**

```ts
export interface Context<Services> extends Equal, Pipeable {
readonly _id: TypeId
readonly _S: (_: Services) => unknown
/** @internal */
export interface Context<Services> extends Equal, Pipeable, Inspectable {
readonly [TypeId]: {
readonly _S: (_: Services) => unknown
}
readonly unsafeMap: Map<Tag<any, any>, any>
}
```
Expand All @@ -249,11 +260,16 @@ Added in v1.0.0
**Signature**

```ts
export interface Tag<Identifier, Service> extends Pipeable {
export interface Tag<Identifier, Service> extends Pipeable, Inspectable {
readonly _tag: 'Tag'
readonly [TagTypeId]: { readonly _S: (_: Service) => Service; readonly _I: (_: Identifier) => Identifier }
readonly [TagTypeId]: {
readonly _S: (_: Service) => Service
readonly _I: (_: Identifier) => Identifier
}
of(self: Service): Service
context(self: Service): Context<Identifier>
readonly stack?: string | undefined
readonly identifier?: unknown | undefined
[Unify.typeSymbol]?: unknown
[Unify.unifySymbol]?: TagUnify<this>
[Unify.blacklistSymbol]?: TagUnifyBlacklist
Expand Down
35 changes: 35 additions & 0 deletions docs/modules/Data.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Added in v1.0.0

- [constructors](#constructors)
- [Class](#class)
- [Structural (class)](#structural-class)
- [[Hash.symbol] (method)](#hashsymbol-method)
- [[Equal.symbol] (method)](#equalsymbol-method)
- [TaggedClass](#taggedclass)
- [array](#array)
- [case](#case)
Expand Down Expand Up @@ -54,6 +57,38 @@ export declare const Class: new <A extends Record<string, any>>(

Added in v1.0.0

## Structural (class)

**Signature**

```ts
export declare class Structural<A> {
constructor(args: Omit<A, keyof Equal.Equal>)
}
```

Added in v1.0.0

### [Hash.symbol] (method)

**Signature**

```ts
[Hash.symbol](this: Equal.Equal)
```

Added in v1.0.0

### [Equal.symbol] (method)

**Signature**

```ts
[Equal.symbol](this: Equal.Equal, that: Equal.Equal)
```

Added in v1.0.0

## TaggedClass

Provides a Tagged constructor for a Case Class.
Expand Down

0 comments on commit a9f8319

Please sign in to comment.