2023-07-14 17:30:58 +02:00
|
|
|
package file
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"io"
|
|
|
|
|
|
2023-07-18 15:57:54 +02:00
|
|
|
IOE "github.com/IBM/fp-go/ioeither"
|
2023-07-14 17:30:58 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func onClose[R io.Closer](r R) IOE.IOEither[error, R] {
|
|
|
|
|
return IOE.TryCatchError(func() (R, error) {
|
|
|
|
|
return r, r.Close()
|
|
|
|
|
})
|
|
|
|
|
}
|