import * as O from 'fp-ts/lib/Option' ; import { pipe } from 'fp-ts/lib/pipeable' ; import Option = O . Option ; const a = O . some ( 41 ) ; const addOne = ( n ) => n + 1 ; const aPlusOne = O . map ( addOne ) ( a ) ; const aPlusTwo = pipe ( a , O . map ( addOne ) , O . map ( addOne ) ) ; console . log ( aPlusOne ) ; console . log ( aPlusTwo ) ; const one = pipe ( aPlusOne , O . fold ( ( ) => null , ( n ) => n ) ) ; const two = pipe ( aPlusTwo , O . toNullable ) ; console . log ( one , two ) ;