Created
November 29, 2022 13:18
-
-
Save blair55/9f167aba17d98bfed9362573c430245b to your computer and use it in GitHub Desktop.
Writer type and utility functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Writer<'Log, 'T> = Writer of (Unit -> 'T * 'Log list) | |
let retn (x: 'T) = Writer(fun () -> x, []) | |
let write (log: 'Log) = Writer(fun () -> (), [ log ]) | |
let run (Writer writer) : 'T * 'Log list = writer () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment