Loading article…
Effは、OCamlと構文が似ている汎用的な高水準のマルチパラダイム関数型プログラミング言語であり、代数的効果ハンドラの機能を統合しています。[ 1 ] [ 2 ]
効果Get_next : ( unit -> unit )オプション効果Add_to_queue : ( unit -> unit ) -> unitlet queue initial = handler | effect Get_next k -> ( fun queue -> match queue with | [] -> ( continue k None ) [] | hd :: tl -> ( continue k ( Some hd )) tl ) | effect ( Add_to_queue y ) k -> ( fun queue -> ( continue k () ) ( queue @ [ y ])) | x -> ( fun _ -> x ) | finally x -> x initial ;;