This library provides functional programming utilities for Racket, including interfaces, such as functors and monads, and common data types that implement those interfaces, such as maybe and either.
Here’s an example of performing monadic computations using functional
:
#lang racket
(require data/applicative
data/monad
data/maybe)
(define try-bytes->string/utf8
(curry exn->maybe exn:fail:contract? bytes->string/utf-8))
(define input-char-length
(do [str <- (try-bytes->string/utf-8 (port->bytes))]
(pure (length str))))