package Ġarrow . effects Ċ Ċ import Ġarrow . Kind Ċ import Ġarrow . core . Either Ċ import Ġarrow . effects . type classes . Exit Case Ċ import Ġarrow . effects . type classes . Monad De fer Ċ Ċ type alias ĠMaybe K Connection Ġ= ĠKind Connection < For Maybe K > Ċ type alias ĠMaybe K Proc < A > Ġ= Ġ( Maybe K Connection , Ġ( Either < Throwable , ĠA >) Ġ-> ĠUnit ) Ġ-> ĠUnit Ċ type alias ĠMaybe K Proc F < A > Ġ= Ġ( Maybe K Connection , Ġ( Either < Throwable , ĠA >) Ġ-> ĠUnit ) Ġ-> ĠKind < For Maybe K , ĠUnit > Ċ Ċ /** Ċ Ġ* ĠConnection Ġfor Ġ[ Maybe K ]. Ċ Ġ* Ċ Ġ* ĠA Ġconnection Ġis Ġrepresented Ġby Ġa Ġcomposite Ġof Ġ` cancel ` Ġfunctions , Ċ Ġ* Ġ[ Kind Connection . cancel ] Ġis Ġide mpot ent Ġand Ġall Ġmethods Ġare Ġthread - safe Ġ& Ġatomic . Ċ Ġ* Ċ Ġ* ĠThe Ġcancellation Ġfunctions Ġare Ġmaintained Ġin Ġa Ġstack Ġand Ġexecuted Ġin Ġa ĠFIFO Ġorder . Ċ Ġ* Ċ Ġ* Ġ@ see ĠMaybe K . async Ċ Ġ*/ Ċ @ Suppress (" FunctionName ") Ċ fun ĠMaybe K Connection ( dummy : ĠUnit Ġ= ĠUnit ): ĠKind Connection < For Maybe K > Ġ= ĠKind Connection ( object Ġ: ĠMonad De fer < For Maybe K > Ġ{ ĊĠ Ġoverride Ġfun Ġ< A > Ġdefer ( fa : Ġ() Ġ-> ĠMaybe K Of < A >): ĠMaybe K < A > Ġ= ĊĠĠĠ ĠMaybe K . defer ( fa ) ĊĊĠ Ġoverride Ġfun Ġ< A > Ġraise Error ( e : ĠThrowable ): ĠMaybe K < A > Ġ= ĊĠĠĠ ĠMaybe K . raise Error ( e ) ĊĊĠ Ġoverride Ġfun Ġ< A > ĠMaybe K Of < A >. handleError With ( f : Ġ( Throwable ) Ġ-> ĠMaybe K Of < A >): ĠMaybe K < A > Ġ= ĊĠĠĠ Ġfix (). handleError With ( f ) ĊĊĠ Ġoverride Ġfun Ġ< A > Ġjust ( a : ĠA ): ĠMaybe K < A > Ġ= ĊĠĠĠ ĠMaybe K . just ( a ) ĊĊĠ Ġoverride Ġfun Ġ< A , ĠB > ĠMaybe K Of < A >. flatMap ( f : Ġ( A ) Ġ-> ĠMaybe K Of < B >): ĠMaybe K < B > Ġ= ĊĠĠĠ Ġfix (). flatMap ( f ) ĊĊĠ Ġoverride Ġfun Ġ< A , ĠB > Ġtail Rec M ( a : ĠA , Ġf : Ġ( A ) Ġ-> ĠMaybe K Of < Either < A , ĠB >> ): ĠMaybe K < B > Ġ= ĊĠĠĠ ĠMaybe K . tail Rec M ( a , Ġf ) ĊĊĠ Ġoverride Ġfun Ġ< A , ĠB > ĠMaybe K Of < A >. bracket Case ( release : Ġ( A , ĠExit Case < Throwable >) Ġ-> ĠMaybe K Of < Unit >, Ġuse : Ġ( A ) Ġ-> ĠMaybe K Of < B >): ĠMaybe K < B > Ġ= ĊĠĠĠ Ġfix (). bracket Case ( release Ġ= Ġrelease , Ġuse Ġ= Ġuse ) Ċ }) Ġ{ Ġit . value (). subscribe ({}, Ġ{}) Ġ} Ċ