3 -behavior(hope_gen_monad).
31 -spec map(t(A, Error), fun((A) -> (B))) ->
35 map({error, _}=Error, _) ->
38 -spec map_error(t(A, B), fun((B) -> (C))) ->
40 map_error({ok, _}=Ok, _) ->
42 map_error({error, Reason}, F) ->
45 -spec tag_error(t(A, Reason), Tag) ->
47 tag_error({ok, _}=Ok, _) ->
49 tag_error({error, Reason}, Tag) ->
50 {error, {Tag, Reason}}.
57 , F :: fun((X) -> t(Ok, Error))
64 ; {ok, Y} -> pipe(Fs, Y)
67 -spec lift_exn(F) -> G
68 when F :: fun((A)-> B)
69 , G :: fun((A)-> t(B, {Class, Reason :: any()}))
74 lift_exn(F) when is_function(F, 1) ->
79 {error, {Class, Reason}}
83 -spec lift_exn(F, Label) -> G
84 when F :: fun((A)-> B)
85 , G :: fun((A)-> t(B, {Label, {Class, Reason :: any()}}))
90 lift_exn(F, Label) when is_function(F, 1) ->
95 tag_error({error, {Class, Reason}}, Label)