So if you were modeling a joke with algebraic data types, it’d be something like

newtype LaughterLevel = PositiveInt

type JokeException =
| NoOneLaughed
| KarenWasOffended
| NaziYelledIAgree

declare const tellJoke: (content: string) => Either<JokeException, LaughterLevel>

#functionalprogramming

Actually i guess this would involve IO too. You need a monad transformer