import { pipe } from 'fp-ts/function';
import * as O from 'fp-ts/Option';
export * from './config';
export * from './lazy';
export function some(value) {
  return O.some(value);
}
export function assertSome(value) {
  const option = O.fromNullable(value);
  if (O.isSome(option)) {
    return option;
  }
  throw new Error('Expected value');
}
export function getOrDefault(option, value) {
  return pipe(option, O.getOrElse(() => value));
}
export function getOrNull(option) {
  return getOrDefault(option, null);
}
export function getOrError(option, error = 'Option value is none.') {
  return pipe(option, O.getOrElse(() => {
    throw new Error(error);
  }));
}
export function toSelectInputOptionsArray(list) {
  return list.map((s) => ({ label: String(s), value: s }));
}
