Hyperlinkv0.8.0-beta.28

Option

Option.noneconsteffect/Option.ts:259
<A = never>(): Option<A>

Creates an Option representing the absence of a value.

When to use

Use to represent a missing or uninitialized value, such as returning "no result" from a function.

Details

  • Returns Option<never>, which is a subtype of Option<A> for any A
  • Always returns the same singleton instance

Example (Creating an empty Option)

import { Option } from "effect"

//      ┌─── Option<never>
//      ▼
const noValue = Option.none()

console.log(noValue)
// Output: { _id: 'Option', _tag: 'None' }
constructorssome
Source effect/Option.ts:2591 lines
export const none = <A = never>(): Option<A> => option.none
Referenced by 94 symbols