1 import Base 2 3 # Says whether an open keeps its handle or rejects the requested options. 4 type Decision is Data: 5 UseLocal{} 6 UseRemote{} 7 RejectOptions{} 8 9 # Picks the handle kind that a matching open keeps. 10 def matched(local: Bool) -> Decision: 11 match local: 12 case True{}: UseLocal{} 13 case False{}: UseRemote{} 14 15 # Keeps the opened handle only when the requested options match the effective ones. 16 def choose(local: Bool, matches: Bool) -> Decision: 17 match matches: 18 case True{}: matched(local) 19 case False{}: RejectOptions{}