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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature request] Magma/magma{First,Last} #1114
Comments
What about using the Semigroup instances? |
@gcanti oops, I've missed that. |
Because a |
@gcanti We could reuse import { getFirstMagma } from './Magma.ts'
export const getFirstSemigroup = getFirstMagma What do you think? |
IMHO we can achieve more proper abstraction of module structure with it. In my case, Additionally, as @raveclassic points out (thanks!), we can reuse the implementation defined in |
@raveclassic @ryota-ka are you proposing to move all the semigroup instances to the I'd just add a short comment instead: /**
* A `Magma` is a pair `(A, concat)` in which `A` is a non-empty set and `concat` is a binary operation on `A`
*
* See [Semigroup](...) for some instances.
*
* @since 2.0.0
*/
export interface Magma<A> {
readonly concat: (x: A, y: A) => A
}
|
At first I didn't mean it, but now I think it's better to have all non-associative instances in @raveclassic What do you think? |
I think the comment is fine for now but we should think about moving instances to Magma module once again before v3.0 |
馃殌 Feature request
For example,
Ord
exports some basic instances likeordString
.in analogous to that, how about exporting
magmaFirst
andmagmaLast
fromMagma
?Current Behavior
N/A
Desired Behavior
some basic instances of
Magma
is exported fromfp-ts/lib/Magma
.Suggested Solution
Who does this impact? Who is this for?
All users
Describe alternatives you've considered
Not to export such stuff from the module.
Additional context
In Haskell's
base
package,First
andLast
are defined asnewtype
s, and they have correspondingSemigroup
instances (Haskell doesn't haveMagma
in the standard library.)Your environment
The text was updated successfully, but these errors were encountered: