Skip to content

Instantly share code, notes, and snippets.

@pocketberserker
Created June 29, 2016 10:38
Show Gist options
  • Save pocketberserker/3c6828b25487b1a15dd9d1ee95b13bf3 to your computer and use it in GitHub Desktop.
Save pocketberserker/3c6828b25487b1a15dd9d1ee95b13bf3 to your computer and use it in GitHub Desktop.
https://twitter.com/7shi/status/748094400606023680 をちょっといじってみる
type ListReaderBuilder() =
member this.Bind(g, f) = function (x::xs) -> (f (g x)) xs | _ -> ()
member this.Return(_) = fun _ -> ()
let listReader = ListReaderBuilder()
let test = listReader {
do! printfn "%d"
do! printfn "%d"
}
test [1;2;3]
printfn "---"
test [4]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment