Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dbrattli
Last active December 17, 2018 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbrattli/1d8d4a43c28b8f2597a48aa03b943df1 to your computer and use it in GitHub Desktop.
Save dbrattli/1d8d4a43c28b8f2597a48aa03b943df1 to your computer and use it in GitHub Desktop.
Duals
// Setters and getters
type Getter<'a> = unit -> 'a
type Setter<'a> = 'a -> unit
// An Enumerator is a getter of values. An Observer is a setter of values
type Enumerator<'a> = unit -> 'a
type Observer<'a> = 'a -> unit
// An Enumerable is a getter of Enumerators. An Observable is a setter of Observers
type Enumerable<'a> = unit -> Enumerator<'a>
type Observable'<'a> = Observer<'a> -> unit
// An Enumerable is a getter - getter. An Observer is a setter - setter
type Enumerable'<'a> = unit -> (unit -> 'a)
type Observable<'a> = ('a -> unit) -> unit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment