Skip to content

Commit

Permalink
Also simplify DF map implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
diogob committed Mar 10, 2024
1 parent 4693b3e commit c3b7059
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/domain-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
UnpackDFObject,
UnpackResult,
} from './types.ts'
import { dfResultFromcomposable } from './constructor.ts'
import { dfResultFromcomposable, toComposable } from './constructor.ts'
import { toErrorWithMessage } from './composable/errors.ts'
import { Composable } from './index.ts'

Expand Down Expand Up @@ -235,13 +235,9 @@ function map<O, R>(
dfn: DomainFunction<O>,
mapper: (element: O) => R | Promise<R>,
): DomainFunction<R> {
return ((input, environment) =>
dfResultFromcomposable(
A.map(
A.composable(() => fromSuccess(dfn)(input, environment)),
mapper,
),
)()) as DomainFunction<R>
return dfResultFromcomposable(
A.map(A.composable(fromSuccess(dfn)), mapper),
) as DomainFunction<R>
}

/**
Expand Down

0 comments on commit c3b7059

Please sign in to comment.