-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: switch to pragmatic type class names
This is a big dumb commit where I dropped all of the Category Theory naming for more intuitive names for all of the algebraic structures. I also dropped almost all of the intermediate structures such as Chain, Apply, Extend, etc. Structures that I never abstracted over have been removed. This includes Semigroupoid, Category, Extend, Comonad. Some of these may return in future versions if there is demand or I find a solid use case. In short, this commit is paradoxical. On the one hand all of the naming and simplification changes were made to make fun more approachable and intuitive. On the other hand I find that I have less time for programming that ever before so interacting with these supposed new users is unlikely. That said, these changes have been in the backlog for awhile and are finally up. With the exception of some deno misfires on coverage reporting I've pushed test coverage to 100%. The next bit of work is to go through all of the algebraic data structures and fill any features holes where an algebraic structure can be implemented or a getter for an algebraic structure can be implemented. FossilOrigin-Name: f46fc828a564c727414299c786ee8192e6734b59eba36226e091cc830edef291
- Loading branch information
brandon
committed
Sep 6, 2023
1 parent
cfbca39
commit 03a83cf
Showing
132 changed files
with
7,561 additions
and
6,087 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* Applicable is a structure that allows a function to be applied inside of the | ||
* associated concrete structure. For example, `Option` may hold a value of | ||
* `(a: A) => B` inside of it. An Applicable for Option would allow one to | ||
* apply the `A` in an `Option<A>` to the function `(a: A) => B` in an | ||
* `Option<(a: A) => B>`, resulting in an `Option<B>`. | ||
* | ||
* @module Applicable | ||
* @since 2.0.0 | ||
*/ | ||
|
||
import type { $, Hold, Kind } from "./kind.ts"; | ||
import type { Combinable } from "./combinable.ts"; | ||
import type { Mappable } from "./mappable.ts"; | ||
import type { Wrappable } from "./wrappable.ts"; | ||
|
||
/** | ||
* The Applicable interface. This interface includes the methods apply, map, and | ||
* wrap. | ||
* | ||
* @since 2.0.0 | ||
*/ | ||
export interface Applicable<U extends Kind> | ||
extends Mappable<U>, Wrappable<U>, Hold<U> { | ||
readonly apply: <A, B = never, C = never, D = unknown, E = unknown>( | ||
ta: $<U, [A, B, C], [D], [E]>, | ||
) => <I, J = never, K = never>( | ||
tfai: $<U, [(value: A) => I, J, K], [D], [E]>, | ||
) => $<U, [I, B | J, C | K], [D], [E]>; | ||
} | ||
|
||
/** | ||
* @since 2.0.0 | ||
*/ | ||
export function getApplicableCombinable<U extends Kind>( | ||
{ apply, map }: Applicable<U>, | ||
): <A, B = never, C = never, D = unknown, E = unknown>( | ||
combinable: Combinable<A>, | ||
) => Combinable<$<U, [A, B, C], [D], [E]>> { | ||
return <A, B = never, C = never, D = unknown, E = unknown>( | ||
{ combine }: Combinable<A>, | ||
): Combinable<$<U, [A, B, C], [D], [E]>> => ({ | ||
combine: (second) => (first) => apply(first)(map(combine)(second)), | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.