CMHGXE7Y2WB5BVYQWGKXKVUGPURGAZVX75HGZ6DDZVUOHAFFKNNAC
scan : Ordering -> Fin n -> Maybe $ Fin $ S n
scan LT FZ = Nothing
scan LT (FS x) = Just $ weaken $ weaken $ x
scan EQ x = Just $ weaken x
scan GT x = Just $ FS $ x
scan : Ordering -> Nat -> Maybe Nat
scan LT Z = Nothing
scan LT (S x) = Just x
scan EQ x = Just $ x
scan GT x = Just $ S $ x
scanner : Vect 3 (Fin n) -> Ordering -> Vect 3 $ Fin $ S n
scanner [x, y, z] w with (scan w z)
_ | Nothing = [FS x, FS x, FZ]
_ | (Just v) = [FS x, weaken y, v]
scanner : (Maybe $ Fin n, Nat) -> (Ordering, Fin n) -> (Maybe $ Fin n, Nat)
scanner (x, y) (w, z) with (scan w y)
_ | Nothing = (Just z, Z)
_ | (Just v) = (x, v)