module FilePickPopupF(filePickF,filePickF',filePickPopupF,filePickPopupF',filePickPopupOptF,filePickPopupOptF',startDir,aFilePath,popup) where
import AllFudgets
import EndButtonsF
--import Files
import Data.List(sort,partition)
import HbcUtils(uncurry3)
import DialogueIO hiding (IOError)
import CompletionStringF
import UnsafePerformIO(unsafePerformIO)
import System.Directory(getCurrentDirectory)

popup :: ([Char], Maybe a)
popup = ([Char]
"OK",Maybe a
forall a. Maybe a
Nothing)

filePickPopupF :: F (a, ([Char], Maybe [Char])) ((a, ([Char], Maybe [Char])), [Char])
filePickPopupF = [(AFilePath -> AFilePath, [Char], [Char])]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), [Char])
forall lbl a.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), [Char])
filePickPopupF' [(AFilePath -> AFilePath, [Char], [Char])]
noextrabuttons
filePickPopupOptF :: F (a, ([Char], Maybe [Char]))
  ((a, ([Char], Maybe [Char])), Maybe [Char])
filePickPopupOptF = [(AFilePath -> AFilePath, [Char], [Char])]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
forall lbl a.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
filePickPopupOptF' [(AFilePath -> AFilePath, [Char], [Char])]
noextrabuttons
filePickF :: F ([Char], Maybe [Char]) (Maybe [Char])
filePickF = [(AFilePath -> AFilePath, [Char], [Char])]
-> F ([Char], Maybe [Char]) (Maybe [Char])
forall lbl.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F ([Char], Maybe [Char]) (Maybe [Char])
filePickF' [(AFilePath -> AFilePath, [Char], [Char])]
noextrabuttons

noextrabuttons :: [(AFilePath -> AFilePath, [Char], [Char])]
noextrabuttons = [] :: ([(AFilePath->AFilePath,KeySym,String)])

filePickPopupF' :: [(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), [Char])
filePickPopupF' [(AFilePath -> AFilePath, [Char], lbl)]
btns = (((a, ([Char], Maybe [Char])), Maybe [Char])
 -> Maybe ((a, ([Char], Maybe [Char])), [Char]))
-> SP
     ((a, ([Char], Maybe [Char])), Maybe [Char])
     ((a, ([Char], Maybe [Char])), [Char])
forall t b. (t -> Maybe b) -> SP t b
mapFilterSP ((a, ([Char], Maybe [Char])), Maybe [Char])
-> Maybe ((a, ([Char], Maybe [Char])), [Char])
forall a b. (a, Maybe b) -> Maybe (a, b)
ok SP
  ((a, ([Char], Maybe [Char])), Maybe [Char])
  ((a, ([Char], Maybe [Char])), [Char])
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), [Char])
forall a b e. SP a b -> F e a -> F e b
>^^=< [(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
forall lbl a.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
filePickPopupOptF' [(AFilePath -> AFilePath, [Char], lbl)]
btns
  where
    ok :: (a, Maybe b) -> Maybe (a, b)
ok (a
x,Maybe b
Nothing) = Maybe (a, b)
forall a. Maybe a
Nothing
    ok (a
x,Just b
y) = (a, b) -> Maybe (a, b)
forall a. a -> Maybe a
Just (a
x,b
y)


filePickPopupOptF' :: [(AFilePath -> AFilePath, [Char], lbl)]
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
filePickPopupOptF' [(AFilePath -> AFilePath, [Char], lbl)]
btns =
  --delayF $ -- commented out to avoid a layout problem under XQuartz
  [Char]
-> Maybe Point
-> F (a, ([Char], Maybe [Char])) (Maybe [Char])
-> F (a, ([Char], Maybe [Char]))
     ((a, ([Char], Maybe [Char])), Maybe [Char])
forall a b. [Char] -> Maybe Point -> F a b -> F a (a, b)
popupShellF [Char]
"File Selection" Maybe Point
forall a. Maybe a
Nothing ([(AFilePath -> AFilePath, [Char], lbl)]
-> F ([Char], Maybe [Char]) (Maybe [Char])
forall lbl.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F ([Char], Maybe [Char]) (Maybe [Char])
filePickF' [(AFilePath -> AFilePath, [Char], lbl)]
btns F ([Char], Maybe [Char]) (Maybe [Char])
-> ((a, ([Char], Maybe [Char])) -> ([Char], Maybe [Char]))
-> F (a, ([Char], Maybe [Char])) (Maybe [Char])
forall c d e. F c d -> (e -> c) -> F e d
>=^< (a, ([Char], Maybe [Char])) -> ([Char], Maybe [Char])
forall a b. (a, b) -> b
snd)


filePickF' :: [(AFilePath -> AFilePath, [Char], lbl)]
-> F ([Char], Maybe [Char]) (Maybe [Char])
filePickF' [(AFilePath -> AFilePath, [Char], lbl)]
btns =
    F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [([Char], [Char])] (InputMsg [Char]))
           (Either Click Click)))
     ([Char], Maybe [Char]))
  (Either
     (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [([Char], [Char])]) [Char]) [Char]))
     (Maybe [Char]))
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [([Char], [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [([Char], [Char])] (InputMsg [Char]))
           (Either Click Click)))
-> F ([Char], Maybe [Char]) (Maybe [Char])
forall a b c d. F (Either a b) (Either c d) -> F c a -> F b d
loopThroughRightF ((AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([Char], AFilePath)])
              (AFilePath -> AFilePath))
           (Either
              (Either [([Char], [Char])] (InputMsg [Char]))
              (Either Click Click)))
        ([Char], Maybe [Char]))
     (Either
        (Either
           (Either (Either [([Char], [Char])] AFilePath) Click)
           (Either (Either ([Char] -> [([Char], [Char])]) [Char]) [Char]))
        (Maybe [Char]))
forall a b a p p b b.
Eq a =>
(AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ctrlF ([Char] -> AFilePath
aFilePath [Char]
startDir,[Char]
"")) ([(AFilePath -> AFilePath, [Char], lbl)]
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [([Char], [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [([Char], [Char])] (InputMsg [Char]))
           (Either Click Click)))
forall lbl a.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click)))
partsF [(AFilePath -> AFilePath, [Char], lbl)]
btns)
  where
    ctrlF :: (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ctrlF st :: (AFilePath, [Char])
st@(AFilePath
dir,[Char]
file) = Cont
  (F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char])))
  (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
forall a ho. Cont (F a ho) a
getF Cont
  (F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char])))
  (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
-> Cont
     (F (Either
           (Either
              (Either
                 (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
              (Either (Either a (InputMsg [Char])) (Either p p)))
           (b, Maybe [Char]))
        (Either
           (Either
              (Either (Either a AFilePath) b)
              (Either (Either ([a] -> [([a], [a])]) [Char]) b))
           (Maybe [Char])))
     (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
forall a b. (a -> b) -> a -> b
$ (Either
   (Either
      (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
   (Either (Either a (InputMsg [Char])) (Either p p))
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> ((b, Maybe [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either Either
  (Either
     (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
  (Either (Either a (InputMsg [Char])) (Either p p))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall b p p.
Either
  (Either
     (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
  (Either (Either a (InputMsg [Char])) (Either p p))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
internal (b, Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
external
      where
        same :: F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same = (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ctrlF (AFilePath, [Char])
st

        internal :: Either
  (Either
     (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
  (Either (Either a (InputMsg [Char])) (Either p p))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
internal = (Either
   (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath)
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> (Either (Either a (InputMsg [Char])) (Either p p)
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either
     (Either
        (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
     (Either (Either a (InputMsg [Char])) (Either p p))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either ((Either (InputMsg AFilePath) [([a], b)]
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> ((AFilePath -> AFilePath)
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either
     (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath)
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either Either (InputMsg AFilePath) [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall b.
Either (InputMsg AFilePath) [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
dirDisp (AFilePath -> AFilePath)
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
goto) ((Either a (InputMsg [Char])
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> (Either p p
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either (Either a (InputMsg [Char])) (Either p p)
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either Either a (InputMsg [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
fileInput Either p p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall p p.
Either p p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
done)

	external :: (b, Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
external (b
lbl,Maybe [Char]
optpath) = Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (b
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a a b. b -> Either (Either a (Either a b)) b
toButtons b
lbl) (Maybe [Char]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
external2 Maybe [Char]
optpath)
          where
	    external2 :: Maybe [Char]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
external2 Maybe [Char]
Nothing = Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (AFilePath
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a b b b. b -> Either (Either (Either (Either a b) b) b) b
toDirDispDir AFilePath
dir) F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same
	    external2 (Just [Char]
s) = AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
newpath ([Char] -> AFilePath
aFilePath [Char]
s)

        dirDisp :: Either (InputMsg AFilePath) [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
dirDisp = (InputMsg AFilePath
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> ([([a], b)]
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either (InputMsg AFilePath) [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either InputMsg AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
pick [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall b.
[([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
dirList
        dirList :: [([a], b)]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
dirList [([a], b)]
list = Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (([a] -> [([a], [a])])
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall a a b b b. a -> Either (Either a (Either (Either a b) b)) b
toFileCompletion ([[a]] -> [a] -> [([a], [a])]
forall a. Eq a => [[a]] -> [a] -> [([a], [a])]
completeFromList ((([a], b) -> [a]) -> [([a], b)] -> [[a]]
forall a b. (a -> b) -> [a] -> [b]
map ([a], b) -> [a]
forall a b. (a, b) -> a
fst [([a], b)]
list))) F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same

        pick :: InputMsg AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
pick InputMsg AFilePath
inp =
	    AFilePath
-> ((AFilePath, [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. AFilePath -> ((AFilePath, [Char]) -> F a b) -> F a b
pathPartsF (AFilePath -> AFilePath
compactPath AFilePath
path) (((AFilePath, [Char])
  -> F (Either
          (Either
             (Either
                (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
             (Either (Either a (InputMsg [Char])) (Either p p)))
          (b, Maybe [Char]))
       (Either
          (Either
             (Either (Either a AFilePath) b)
             (Either (Either ([a] -> [([a], [a])]) [Char]) b))
          (Maybe [Char])))
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> ((AFilePath, [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. (a -> b) -> a -> b
$ \ st' :: (AFilePath, [Char])
st'@(AFilePath
dir',[Char]
file') ->
	    if [Char]
file'[Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
==[Char]
""
	    then (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change (AFilePath
dir',[Char]
file) -- keep previous file name
	    else case InputMsg AFilePath -> Maybe AFilePath
forall a. InputMsg a -> Maybe a
inputDone InputMsg AFilePath
inp of
	           Maybe AFilePath
Nothing -> (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change (AFilePath, [Char])
st'
		   Just AFilePath
_ -> if [Char]
file'[Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
==[Char]
file -- Hmm. Check dir too.
		             then AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
output AFilePath
path
			     else F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same -- false double click
	  where
	    path :: AFilePath
path = InputMsg AFilePath -> AFilePath
forall p. InputMsg p -> p
stripInputMsg InputMsg AFilePath
inp

	goto :: (AFilePath -> AFilePath)
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
goto AFilePath -> AFilePath
f = (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change (AFilePath -> AFilePath
f AFilePath
dir,[Char]
file)

        fileInput :: Either a (InputMsg [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
fileInput = (a
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> (InputMsg [Char]
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either a (InputMsg [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either a
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
completionList InputMsg [Char]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
filename

        completionList :: a
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
completionList = (Either
   (Either
      (Either (Either a AFilePath) b)
      (Either (Either ([a] -> [([a], [a])]) [Char]) b))
   (Maybe [Char])
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char]))
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b c. (a -> b -> c) -> b -> a -> c
flip Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same (Either
   (Either
      (Either (Either a AFilePath) b)
      (Either (Either ([a] -> [([a], [a])]) [Char]) b))
   (Maybe [Char])
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> (a
    -> Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char]))
-> a
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall a b b b b. a -> Either (Either (Either (Either a b) b) b) b
toDirDispCompletions

	filename :: InputMsg [Char]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
filename InputMsg [Char]
inp =
	    case InputMsg [Char] -> Maybe [Char]
forall a. InputMsg a -> Maybe a
inputDone InputMsg [Char]
inp of
	      Maybe [Char]
Nothing -> (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ctrlF (AFilePath
dir,InputMsg [Char] -> [Char]
forall p. InputMsg p -> p
stripInputMsg InputMsg [Char]
inp)
	      Just [Char]
"" -> F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same
	      --Just name@('/':_) -> newname (aFilePath name)
	      --Just name -> newname (extendPath dir name)
	      Just [Char]
path' -> AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
newname (AFilePath -> AFilePath -> AFilePath
joinPaths AFilePath
dir ([Char] -> AFilePath
aFilePath [Char]
path'))
	  where
	     newname :: AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
newname AFilePath
path =
	       AFilePath
-> ((AFilePath, [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. AFilePath -> ((AFilePath, [Char]) -> F a b) -> F a b
pathPartsF (AFilePath -> AFilePath
compactPath AFilePath
path) (((AFilePath, [Char])
  -> F (Either
          (Either
             (Either
                (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
             (Either (Either a (InputMsg [Char])) (Either p p)))
          (b, Maybe [Char]))
       (Either
          (Either
             (Either (Either a AFilePath) b)
             (Either (Either ([a] -> [([a], [a])]) [Char]) b))
          (Maybe [Char])))
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> ((AFilePath, [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. (a -> b) -> a -> b
$ \ st' :: (AFilePath, [Char])
st'@(AFilePath
dir',[Char]
file') ->
	       if [Char]
file'[Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
==[Char]
""
	       then (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change (AFilePath, [Char])
st'
	       else AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
output (AFilePath -> [Char] -> AFilePath
extendPath AFilePath
dir' [Char]
file')

	done :: Either p p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
done = (p
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> (p
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> Either p p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall p.
p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ok p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall p.
p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
cancel
	  where
	    ok :: p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ok p
_ = Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (Maybe [Char]
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a. b -> Either a b
out ([Char] -> Maybe [Char]
forall a. a -> Maybe a
Just (AFilePath -> [Char]
filePath (AFilePath -> [Char] -> AFilePath
extendPath AFilePath
dir [Char]
file)))) F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same
	    cancel :: p
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
cancel p
_ = Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (Maybe [Char]
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a. b -> Either a b
out Maybe [Char]
forall a. Maybe a
Nothing) F (Either
     (Either
        (Either
           (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
        (Either (Either a (InputMsg [Char])) (Either p p)))
     (b, Maybe [Char]))
  (Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char]))
same

        newpath :: AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
newpath AFilePath
path = AFilePath
-> ((AFilePath, [Char])
    -> F (Either
            (Either
               (Either
                  (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
               (Either (Either a (InputMsg [Char])) (Either p p)))
            (b, Maybe [Char]))
         (Either
            (Either
               (Either (Either a AFilePath) b)
               (Either (Either ([a] -> [([a], [a])]) [Char]) b))
            (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. AFilePath -> ((AFilePath, [Char]) -> F a b) -> F a b
pathPartsF (AFilePath -> AFilePath
compactPath AFilePath
path) (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change

	change :: (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
change st :: (AFilePath, [Char])
st@(AFilePath
dir',[Char]
file') =
	   [Either
   (Either
      (Either (Either a AFilePath) b)
      (Either (Either ([a] -> [([a], [a])]) [Char]) b))
   (Maybe [Char])]
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall b a. [b] -> F a b -> F a b
putsF ([[Char]
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a a b b. b -> Either (Either a (Either (Either a b) b)) b
toFileInput [Char]
file'][Either
   (Either
      (Either (Either a AFilePath) b)
      (Either (Either ([a] -> [([a], [a])]) [Char]) b))
   (Maybe [Char])]
-> [Either
      (Either
         (Either (Either a AFilePath) b)
         (Either (Either ([a] -> [([a], [a])]) [Char]) b))
      (Maybe [Char])]
-> [Either
      (Either
         (Either (Either a AFilePath) b)
         (Either (Either ([a] -> [([a], [a])]) [Char]) b))
      (Maybe [Char])]
forall a. [a] -> [a] -> [a]
++
	          (if AFilePath
dir'AFilePath -> AFilePath -> Bool
forall a. Eq a => a -> a -> Bool
/=AFilePath
dir then [AFilePath
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a b b b. b -> Either (Either (Either (Either a b) b) b) b
toDirDispDir AFilePath
dir'] else [])) (F (Either
      (Either
         (Either
            (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
         (Either (Either a (InputMsg [Char])) (Either p p)))
      (b, Maybe [Char]))
   (Either
      (Either
         (Either (Either a AFilePath) b)
         (Either (Either ([a] -> [([a], [a])]) [Char]) b))
      (Maybe [Char]))
 -> F (Either
         (Either
            (Either
               (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
            (Either (Either a (InputMsg [Char])) (Either p p)))
         (b, Maybe [Char]))
      (Either
         (Either
            (Either (Either a AFilePath) b)
            (Either (Either ([a] -> [([a], [a])]) [Char]) b))
         (Maybe [Char])))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall a b. (a -> b) -> a -> b
$
	   (AFilePath, [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
ctrlF (AFilePath, [Char])
st

        output :: AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
output AFilePath
path =
	    Either
  (Either
     (Either (Either a AFilePath) b)
     (Either (Either ([a] -> [([a], [a])]) [Char]) b))
  (Maybe [Char])
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
forall ho hi. ho -> F hi ho -> F hi ho
putF (Maybe [Char]
-> Either
     (Either
        (Either (Either a AFilePath) b)
        (Either (Either ([a] -> [([a], [a])]) [Char]) b))
     (Maybe [Char])
forall b a. b -> Either a b
out ([Char] -> Maybe [Char]
forall a. a -> Maybe a
Just (AFilePath -> [Char]
filePath AFilePath
path'))) (AFilePath
-> F (Either
        (Either
           (Either
              (Either (InputMsg AFilePath) [([a], b)]) (AFilePath -> AFilePath))
           (Either (Either a (InputMsg [Char])) (Either p p)))
        (b, Maybe [Char]))
     (Either
        (Either
           (Either (Either a AFilePath) b)
           (Either (Either ([a] -> [([a], [a])]) [Char]) b))
        (Maybe [Char]))
newpath AFilePath
path')
	  where
	    path' :: AFilePath
path' = AFilePath -> AFilePath
compactPath AFilePath
path

        out :: b -> Either a b
out = b -> Either a b
forall a b. b -> Either a b
Right
	toDirDisp :: a -> Either (Either (Either a b) b) b
toDirDisp = Either (Either a b) b -> Either (Either (Either a b) b) b
forall a b. a -> Either a b
Left(Either (Either a b) b -> Either (Either (Either a b) b) b)
-> (a -> Either (Either a b) b)
-> a
-> Either (Either (Either a b) b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either a b -> Either (Either a b) b
forall a b. a -> Either a b
Left(Either a b -> Either (Either a b) b)
-> (a -> Either a b) -> a -> Either (Either a b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Either a b
forall a b. a -> Either a b
Left
	toDirDispDir :: b -> Either (Either (Either (Either a b) b) b) b
toDirDispDir = Either a b -> Either (Either (Either (Either a b) b) b) b
forall a b b b. a -> Either (Either (Either a b) b) b
toDirDisp(Either a b -> Either (Either (Either (Either a b) b) b) b)
-> (b -> Either a b)
-> b
-> Either (Either (Either (Either a b) b) b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either a b
forall a b. b -> Either a b
Right
	toDirDispCompletions :: a -> Either (Either (Either (Either a b) b) b) b
toDirDispCompletions = Either a b -> Either (Either (Either (Either a b) b) b) b
forall a b b b. a -> Either (Either (Either a b) b) b
toDirDisp(Either a b -> Either (Either (Either (Either a b) b) b) b)
-> (a -> Either a b)
-> a
-> Either (Either (Either (Either a b) b) b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Either a b
forall a b. a -> Either a b
Left
	toFileInput :: b -> Either (Either a (Either (Either a b) b)) b
toFileInput= Either a (Either (Either a b) b)
-> Either (Either a (Either (Either a b) b)) b
forall a b. a -> Either a b
Left(Either a (Either (Either a b) b)
 -> Either (Either a (Either (Either a b) b)) b)
-> (b -> Either a (Either (Either a b) b))
-> b
-> Either (Either a (Either (Either a b) b)) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either (Either a b) b -> Either a (Either (Either a b) b)
forall a b. b -> Either a b
Right(Either (Either a b) b -> Either a (Either (Either a b) b))
-> (b -> Either (Either a b) b)
-> b
-> Either a (Either (Either a b) b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either a b -> Either (Either a b) b
forall a b. a -> Either a b
Left(Either a b -> Either (Either a b) b)
-> (b -> Either a b) -> b -> Either (Either a b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either a b
forall a b. b -> Either a b
Right
	toFileCompletion :: a -> Either (Either a (Either (Either a b) b)) b
toFileCompletion=Either a (Either (Either a b) b)
-> Either (Either a (Either (Either a b) b)) b
forall a b. a -> Either a b
Left(Either a (Either (Either a b) b)
 -> Either (Either a (Either (Either a b) b)) b)
-> (a -> Either a (Either (Either a b) b))
-> a
-> Either (Either a (Either (Either a b) b)) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either (Either a b) b -> Either a (Either (Either a b) b)
forall a b. b -> Either a b
Right(Either (Either a b) b -> Either a (Either (Either a b) b))
-> (a -> Either (Either a b) b)
-> a
-> Either a (Either (Either a b) b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either a b -> Either (Either a b) b
forall a b. a -> Either a b
Left(Either a b -> Either (Either a b) b)
-> (a -> Either a b) -> a -> Either (Either a b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Either a b
forall a b. a -> Either a b
Left
	toButtons :: b -> Either (Either a (Either a b)) b
toButtons=Either a (Either a b) -> Either (Either a (Either a b)) b
forall a b. a -> Either a b
Left(Either a (Either a b) -> Either (Either a (Either a b)) b)
-> (b -> Either a (Either a b))
-> b
-> Either (Either a (Either a b)) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Either a b -> Either a (Either a b)
forall a b. b -> Either a b
Right(Either a b -> Either a (Either a b))
-> (b -> Either a b) -> b -> Either a (Either a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either a b
forall a b. b -> Either a b
Right

partsF :: [(AFilePath -> AFilePath, [Char], lbl)]
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click)))
partsF [(AFilePath -> AFilePath, [Char], lbl)]
btns =
  F (Either
     (Either (Either [([Char], [Char])] AFilePath) Click)
     (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char]))
  (Either
     (Either
        (Either (InputMsg AFilePath) [([Char], AFilePath)])
        (AFilePath -> AFilePath))
     (Either
        (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click)))
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click)))
forall a b. F a b -> F a b
vBoxF ((F (Either [([Char], [Char])] AFilePath)
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
dirDispFF (Either [([Char], [Char])] AFilePath)
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
-> F Click (AFilePath -> AFilePath)
-> F (Either (Either [([Char], [Char])] AFilePath) Click)
     (Either
        (Either (InputMsg AFilePath) [([Char], AFilePath)])
        (AFilePath -> AFilePath))
forall a b c d. F a b -> F c d -> F (Either a c) (Either b d)
>+<[(AFilePath -> AFilePath, [Char], lbl)]
-> F Click (AFilePath -> AFilePath)
forall lbl.
Graphic lbl =>
[(AFilePath -> AFilePath, [Char], lbl)]
-> F Click (AFilePath -> AFilePath)
gotoButtonsF [(AFilePath -> AFilePath, [Char], lbl)]
btns)F (Either (Either [([Char], [Char])] AFilePath) Click)
  (Either
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
     (AFilePath -> AFilePath))
-> F (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char])
     (Either
        (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click))
-> F (Either
        (Either (Either [([Char], [Char])] AFilePath) Click)
        (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char]))
     (Either
        (Either
           (Either (InputMsg AFilePath) [([Char], AFilePath)])
           (AFilePath -> AFilePath))
        (Either
           (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click)))
forall a b c d. F a b -> F c d -> F (Either a c) (Either b d)
>+<(F (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
forall a.
F (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
fileInputFF (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
-> F [Char] (Either Click Click)
-> F (Either (Either ([Char] -> [(a, [Char])]) [Char]) [Char])
     (Either
        (Either [(a, [Char])] (InputMsg [Char])) (Either Click Click))
forall a b c d. F a b -> F c d -> F (Either a c) (Either b d)
>+<F [Char] (Either Click Click)
endButtonsF'))

dirDispF :: F (Either [([Char], [Char])] AFilePath)
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
dirDispF =
    Either
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
-> Either (InputMsg AFilePath) [([Char], AFilePath)]
forall p. Either p p -> p
stripEither (Either
   (Either (InputMsg AFilePath) [([Char], AFilePath)])
   (Either (InputMsg AFilePath) [([Char], AFilePath)])
 -> Either (InputMsg AFilePath) [([Char], AFilePath)])
-> F (Either [Char] (Either [([Char], [Char])] [Char]))
     (Either
        (Either (InputMsg AFilePath) [([Char], AFilePath)])
        (Either (InputMsg AFilePath) [([Char], AFilePath)]))
-> F (Either [Char] (Either [([Char], [Char])] [Char]))
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
forall a b e. (a -> b) -> F e a -> F e b
>^=< F (Either [Char] (Either [([Char], [Char])] [Char]))
  (Either
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
     (Either (InputMsg AFilePath) [([Char], AFilePath)]))
-> F (Either [Char] (Either [([Char], [Char])] [Char]))
     (Either
        (Either (InputMsg AFilePath) [([Char], AFilePath)])
        (Either (InputMsg AFilePath) [([Char], AFilePath)]))
forall a b. F a b -> F a b
vBoxF (F [Char] (Either (InputMsg AFilePath) [([Char], AFilePath)])
forall b. F [Char] b
pathDispF F [Char] (Either (InputMsg AFilePath) [([Char], AFilePath)])
-> F (Either [([Char], [Char])] [Char])
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
-> F (Either [Char] (Either [([Char], [Char])] [Char]))
     (Either
        (Either (InputMsg AFilePath) [([Char], AFilePath)])
        (Either (InputMsg AFilePath) [([Char], AFilePath)]))
forall a b c d. F a b -> F c d -> F (Either a c) (Either b d)
>+< F (Either [([Char], [Char])] [Char])
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
dirListF) F (Either [Char] (Either [([Char], [Char])] [Char]))
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
-> SP
     (Either [([Char], [Char])] AFilePath)
     (Either [Char] (Either [([Char], [Char])] [Char]))
-> F (Either [([Char], [Char])] AFilePath)
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
forall c d e. F c d -> SP e c -> F e d
>=^^< (Either [([Char], [Char])] AFilePath
 -> [Either [Char] (Either [([Char], [Char])] [Char])])
-> SP
     (Either [([Char], [Char])] AFilePath)
     (Either [Char] (Either [([Char], [Char])] [Char]))
forall t b. (t -> [b]) -> SP t b
concatMapSP Either [([Char], [Char])] AFilePath
-> [Either [Char] (Either [([Char], [Char])] [Char])]
forall a. Either a AFilePath -> [Either [Char] (Either a [Char])]
pre
  where
    pre :: Either a AFilePath -> [Either [Char] (Either a [Char])]
pre (Left a
completions) = [Either a [Char] -> Either [Char] (Either a [Char])
forall a b. b -> Either a b
Right (a -> Either a [Char]
forall a b. a -> Either a b
Left a
completions)]
    pre (Right AFilePath
path) = [[Char] -> Either [Char] (Either a [Char])
forall a b. a -> Either a b
Left [Char]
newdir,Either a [Char] -> Either [Char] (Either a [Char])
forall a b. b -> Either a b
Right ([Char] -> Either a [Char]
forall a b. b -> Either a b
Right [Char]
newdir)]
      where newdir :: [Char]
newdir = AFilePath -> [Char]
filePath AFilePath
path

    pathDispF :: F [Char] b
pathDispF = Customiser (DisplayF [Char]) -> F [Char] b
forall a b. Graphic a => Customiser (DisplayF a) -> F a b
displayF' Customiser (DisplayF [Char])
pm
      where pm :: Customiser (DisplayF [Char])
pm = Alignment -> Customiser (DisplayF [Char])
forall xxx. HasAlign xxx => Alignment -> Customiser xxx
setAlign Alignment
aCenterCustomiser (DisplayF [Char])
-> Customiser (DisplayF [Char]) -> Customiser (DisplayF [Char])
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
                 [Char] -> Customiser (DisplayF [Char])
forall xxx a.
(HasBgColorSpec xxx, Show a, ColorGen a) =>
a -> Customiser xxx
setBgColor [Char]
bgColorCustomiser (DisplayF [Char])
-> Customiser (DisplayF [Char]) -> Customiser (DisplayF [Char])
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
		 Int -> Customiser (DisplayF [Char])
forall xxx. HasBorderWidth xxx => Int -> Customiser xxx
setBorderWidth Int
0Customiser (DisplayF [Char])
-> Customiser (DisplayF [Char]) -> Customiser (DisplayF [Char])
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
		 [Char] -> Customiser (DisplayF [Char])
forall xxx a.
(HasFontSpec xxx, Show a, FontGen a) =>
a -> Customiser xxx
setFont [Char]
labelFont

    dirListF :: F (Either [([Char], [Char])] [Char])
  (Either (InputMsg AFilePath) [([Char], AFilePath)])
dirListF = F (Either
     (Either
        (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
     (Either [([Char], [Char])] [Char]))
  (Either
     (Either (ListRequest ([Char], AFilePath)) [Char])
     (Either (InputMsg AFilePath) [([Char], AFilePath)]))
-> F (Either (ListRequest ([Char], AFilePath)) [Char])
     (Either
        (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
-> F (Either [([Char], [Char])] [Char])
     (Either (InputMsg AFilePath) [([Char], AFilePath)])
forall a b c d. F (Either a b) (Either c d) -> F c a -> F b d
loopThroughRightF (([([Char], AFilePath)]
 -> Either
      (Either
         (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
      (Either [([Char], [Char])] [Char])
 -> ([([Char], AFilePath)],
     [Either
        (Either (ListRequest ([Char], AFilePath)) [Char])
        (Either (InputMsg AFilePath) [([Char], AFilePath)])]))
-> [([Char], AFilePath)]
-> F (Either
        (Either
           (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
        (Either [([Char], [Char])] [Char]))
     (Either
        (Either (ListRequest ([Char], AFilePath)) [Char])
        (Either (InputMsg AFilePath) [([Char], AFilePath)]))
forall t a b. (t -> a -> (t, [b])) -> t -> F a b
mapstateF [([Char], AFilePath)]
-> Either
     (Either
        (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
     (Either [([Char], [Char])] [Char])
-> ([([Char], AFilePath)],
    [Either
       (Either (ListRequest ([Char], AFilePath)) [Char])
       (Either (InputMsg AFilePath) [([Char], AFilePath)])])
forall a b a a b.
Eq a =>
[([a], b)]
-> Either
     (Either (InputMsg (Int, (a, a))) [([a], b)])
     (Either [([a], [a])] b)
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
ctrl []) ((([Char], AFilePath) -> [Char])
-> F (ListRequest ([Char], AFilePath))
     (InputMsg (Int, ([Char], AFilePath)))
forall a.
(a -> [Char]) -> F (PickListRequest a) (InputMsg (Int, a))
pickListF ([Char], AFilePath) -> [Char]
forall a b. (a, b) -> a
fst F (ListRequest ([Char], AFilePath))
  (InputMsg (Int, ([Char], AFilePath)))
-> F [Char] [([Char], AFilePath)]
-> F (Either (ListRequest ([Char], AFilePath)) [Char])
     (Either
        (InputMsg (Int, ([Char], AFilePath))) [([Char], AFilePath)])
forall a b c d. F a b -> F c d -> F (Either a c) (Either b d)
>+< F [Char] [([Char], AFilePath)]
lsF)
      where
        ctrl :: [([a], b)]
-> Either
     (Either (InputMsg (Int, (a, a))) [([a], b)])
     (Either [([a], [a])] b)
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
ctrl [([a], b)]
list = (Either (InputMsg (Int, (a, a))) [([a], b)]
 -> ([([a], b)],
     [Either
        (Either (ListRequest ([a], b)) b)
        (Either (InputMsg a) [([a], b)])]))
-> (Either [([a], [a])] b
    -> ([([a], b)],
        [Either
           (Either (ListRequest ([a], b)) b)
           (Either (InputMsg a) [([a], b)])]))
-> Either
     (Either (InputMsg (Int, (a, a))) [([a], b)])
     (Either [([a], [a])] b)
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either ((InputMsg (Int, (a, a))
 -> ([([a], b)],
     [Either
        (Either (ListRequest ([a], b)) b)
        (Either (InputMsg a) [([a], b)])]))
-> ([([a], b)]
    -> ([([a], b)],
        [Either
           (Either (ListRequest ([a], b)) b)
           (Either (InputMsg a) [([a], b)])]))
-> Either (InputMsg (Int, (a, a))) [([a], b)]
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either InputMsg (Int, (a, a))
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
forall a a a b b.
InputMsg (Int, (a, a))
-> ([([a], b)],
    [Either (Either (ListRequest a) b) (Either (InputMsg a) b)])
fromPickListF [([a], b)]
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
forall a b a.
[a] -> ([a], [Either (Either (ListRequest a) b) (Either a [a])])
fromLsF) Either [([a], [a])] b
-> ([([a], b)],
    [Either
       (Either (ListRequest ([a], b)) b)
       (Either (InputMsg a) [([a], b)])])
forall b a b.
Either [([a], [a])] b
-> ([([a], b)], [Either (Either (ListRequest a) b) b])
fromInput
	  where
	    fromInput :: Either [([a], [a])] b
-> ([([a], b)], [Either (Either (ListRequest a) b) b])
fromInput = ([([a], [a])]
 -> ([([a], b)], [Either (Either (ListRequest a) b) b]))
-> (b -> ([([a], b)], [Either (Either (ListRequest a) b) b]))
-> Either [([a], [a])] b
-> ([([a], b)], [Either (Either (ListRequest a) b) b])
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either [([a], [a])] -> ([([a], b)], [Either (Either (ListRequest a) b) b])
forall a b b.
[([a], [a])] -> ([([a], b)], [Either (Either (ListRequest a) b) b])
completions b -> ([([a], b)], [Either (Either (ListRequest a) b) b])
forall b a b. b -> ([([a], b)], [Either (Either a b) b])
newDir
	    completions :: [([a], [a])] -> ([([a], b)], [Either (Either (ListRequest a) b) b])
completions [([a], [a])]
cs = Either (Either (ListRequest a) b) b
-> ([([a], b)], [Either (Either (ListRequest a) b) b])
forall a. a -> ([([a], b)], [a])
put (ListRequest a -> Either (Either (ListRequest a) b) b
forall a b b. a -> Either (Either a b) b
toPickListF ListRequest a
forall a. ListRequest a
hilite)
	      where
	        hilite :: ListRequest a
hilite = [Int] -> ListRequest a
forall a. [Int] -> ListRequest a
highlightItems
	                       [Int
i|(Int
i,([a]
n,b
_))<-[Int] -> [([a], b)] -> [(Int, ([a], b))]
forall a b. [a] -> [b] -> [(a, b)]
zip [Int
0..] [([a], b)]
list,[a]
n [a] -> [[a]] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [[a]]
ns]
		ns :: [[a]]
ns = [[a]
pre[a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++[a]
compl|([a]
pre,[a]
compl)<-[([a], [a])]
cs]
	    newDir :: b -> ([([a], b)], [Either (Either a b) b])
newDir = Either (Either a b) b -> ([([a], b)], [Either (Either a b) b])
forall a. a -> ([([a], b)], [a])
put (Either (Either a b) b -> ([([a], b)], [Either (Either a b) b]))
-> (b -> Either (Either a b) b)
-> b
-> ([([a], b)], [Either (Either a b) b])
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either (Either a b) b
forall b a b. b -> Either (Either a b) b
toLsF
	    fromPickListF :: InputMsg (Int, (a, a))
-> ([([a], b)],
    [Either (Either (ListRequest a) b) (Either (InputMsg a) b)])
fromPickListF InputMsg (Int, (a, a))
msg =
	      Either (Either (ListRequest a) b) (Either (InputMsg a) b)
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
-> ([([a], b)],
    [Either (Either (ListRequest a) b) (Either (InputMsg a) b)])
forall a. a -> a -> ([([a], b)], [a])
put2 (InputMsg a
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall a a b. a -> Either a (Either a b)
outPick (InputMsg a
 -> Either (Either (ListRequest a) b) (Either (InputMsg a) b))
-> (InputMsg (Int, (a, a)) -> InputMsg a)
-> InputMsg (Int, (a, a))
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((Int, (a, a)) -> a) -> InputMsg (Int, (a, a)) -> InputMsg a
forall t a. (t -> a) -> InputMsg t -> InputMsg a
mapInp ((a, a) -> a
forall a b. (a, b) -> b
snd((a, a) -> a) -> ((Int, (a, a)) -> (a, a)) -> (Int, (a, a)) -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Int, (a, a)) -> (a, a)
forall a b. (a, b) -> b
snd) (InputMsg (Int, (a, a))
 -> Either (Either (ListRequest a) b) (Either (InputMsg a) b))
-> InputMsg (Int, (a, a))
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall a b. (a -> b) -> a -> b
$ InputMsg (Int, (a, a))
msg)
	           (ListRequest a
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall a b b. a -> Either (Either a b) b
toPickListF(ListRequest a
 -> Either (Either (ListRequest a) b) (Either (InputMsg a) b))
-> (InputMsg (Int, (a, a)) -> ListRequest a)
-> InputMsg (Int, (a, a))
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.[Int] -> ListRequest a
forall a. [Int] -> ListRequest a
highlightItems([Int] -> ListRequest a)
-> (InputMsg (Int, (a, a)) -> [Int])
-> InputMsg (Int, (a, a))
-> ListRequest a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Int -> [Int] -> [Int]
forall a. a -> [a] -> [a]
:[])(Int -> [Int])
-> (InputMsg (Int, (a, a)) -> Int)
-> InputMsg (Int, (a, a))
-> [Int]
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(Int, (a, a)) -> Int
forall a b. (a, b) -> a
fst((Int, (a, a)) -> Int)
-> (InputMsg (Int, (a, a)) -> (Int, (a, a)))
-> InputMsg (Int, (a, a))
-> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
.InputMsg (Int, (a, a)) -> (Int, (a, a))
forall p. InputMsg p -> p
stripInputMsg (InputMsg (Int, (a, a))
 -> Either (Either (ListRequest a) b) (Either (InputMsg a) b))
-> InputMsg (Int, (a, a))
-> Either (Either (ListRequest a) b) (Either (InputMsg a) b)
forall a b. (a -> b) -> a -> b
$ InputMsg (Int, (a, a))
msg)
	    fromLsF :: [a] -> ([a], [Either (Either (ListRequest a) b) (Either a [a])])
fromLsF [a]
list' = ([a]
list',[[a] -> Either (Either (ListRequest a) b) (Either a [a])
forall b a a. b -> Either a (Either a b)
outDir [a]
list',ListRequest a -> Either (Either (ListRequest a) b) (Either a [a])
forall a b b. a -> Either (Either a b) b
toPickListF ([a] -> ListRequest a
forall a. [a] -> ListRequest a
replaceAll [a]
list')])

	    put :: a -> ([([a], b)], [a])
put a
x = ([([a], b)]
list,[a
x])
	    put2 :: a -> a -> ([([a], b)], [a])
put2 a
x a
y = ([([a], b)]
list,[a
x,a
y])

	    out :: b -> Either a b
out = b -> Either a b
forall a b. b -> Either a b
Right
	    outDir :: b -> Either a (Either a b)
outDir = Either a b -> Either a (Either a b)
forall b a. b -> Either a b
out (Either a b -> Either a (Either a b))
-> (b -> Either a b) -> b -> Either a (Either a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either a b
forall a b. b -> Either a b
Right
	    outPick :: a -> Either a (Either a b)
outPick = Either a b -> Either a (Either a b)
forall b a. b -> Either a b
out (Either a b -> Either a (Either a b))
-> (a -> Either a b) -> a -> Either a (Either a b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Either a b
forall a b. a -> Either a b
Left
	    loop :: a -> Either a b
loop = a -> Either a b
forall a b. a -> Either a b
Left
	    toPickListF :: a -> Either (Either a b) b
toPickListF = Either a b -> Either (Either a b) b
forall a b. a -> Either a b
loop (Either a b -> Either (Either a b) b)
-> (a -> Either a b) -> a -> Either (Either a b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> Either a b
forall a b. a -> Either a b
Left
	    toLsF :: b -> Either (Either a b) b
toLsF = Either a b -> Either (Either a b) b
forall a b. a -> Either a b
loop (Either a b -> Either (Either a b) b)
-> (b -> Either a b) -> b -> Either (Either a b) b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> Either a b
forall a b. b -> Either a b
Right

    lsF :: F [Char] [([Char], AFilePath)]
lsF = F [AFilePath] [([Char], AFilePath)]
showFilesFF [AFilePath] [([Char], AFilePath)]
-> F [Char] [AFilePath] -> F [Char] [([Char], AFilePath)]
forall a1 b a2. F a1 b -> F a2 a1 -> F a2 b
>==<([Char], Either IOError [[Char]]) -> [AFilePath]
forall a. Show a => ([Char], Either a [[Char]]) -> [AFilePath]
paths(([Char], Either IOError [[Char]]) -> [AFilePath])
-> F [Char] ([Char], Either IOError [[Char]])
-> F [Char] [AFilePath]
forall a b e. (a -> b) -> F e a -> F e b
>^=<F [Char] ([Char], Either IOError [[Char]])
readDirF
      where
	paths :: ([Char], Either a [[Char]]) -> [AFilePath]
paths ([Char]
dir,Either a [[Char]]
resp) =
	    case Either a [[Char]]
resp of
	      Right [[Char]]
files -> (([Char] -> AFilePath) -> [[Char]] -> [AFilePath]
forall a b. (a -> b) -> [a] -> [b]
map (AFilePath -> [Char] -> AFilePath
extendPath AFilePath
sdir) ([[Char]] -> [AFilePath])
-> ([[Char]] -> [[Char]]) -> [[Char]] -> [AFilePath]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [[Char]] -> [[Char]]
sortFiles) [[Char]]
files
	      Left a
err   -> [AFilePath -> [Char] -> AFilePath
extendPath AFilePath
sdir (a -> [Char]
forall a. Show a => a -> [Char]
show a
err)]
	  where sdir :: AFilePath
sdir = [Char] -> AFilePath
aFilePath [Char]
dir
	        sortFiles :: [[Char]] -> [[Char]]
sortFiles [[Char]]
files =
		  case ([Char] -> Bool) -> [[Char]] -> ([[Char]], [[Char]])
forall a. (a -> Bool) -> [a] -> ([a], [a])
partition [Char] -> Bool
isDotFile [[Char]]
files of
		    ([[Char]]
dfs,[[Char]]
fs) -> [[Char]] -> [[Char]]
forall a. Ord a => [a] -> [a]
sort [[Char]]
fs [[Char]] -> [[Char]] -> [[Char]]
forall a. [a] -> [a] -> [a]
++
		                [[Char]] -> [[Char]]
forall a. Ord a => [a] -> [a]
sort [ [Char]
f | [Char]
f<-[[Char]]
dfs, [Char]
f [Char] -> [[Char]] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`notElem` [[Char]
".",[Char]
".."]]
		isDotFile :: [Char] -> Bool
isDotFile (Char
'.':[Char]
_) = Bool
True
		isDotFile [Char]
_ = Bool
False

	showFilesF :: F [AFilePath] [([Char], AFilePath)]
showFilesF = ([AFilePath]
 -> ([([Char], AFilePath)] -> F [AFilePath] [([Char], AFilePath)])
 -> F [AFilePath] [([Char], AFilePath)])
-> F [AFilePath] [([Char], AFilePath)]
forall hi ho. (hi -> (ho -> F hi ho) -> F hi ho) -> F hi ho
contMapF [AFilePath]
-> ([([Char], AFilePath)] -> F [AFilePath] [([Char], AFilePath)])
-> F [AFilePath] [([Char], AFilePath)]
forall a b. [AFilePath] -> Cont (F a b) [([Char], AFilePath)]
showFiles
	showFiles :: [AFilePath] -> Cont (F a b) [([Char], AFilePath)]
showFiles = (AFilePath -> Cont (F a b) ([Char], AFilePath))
-> [AFilePath] -> Cont (F a b) [([Char], AFilePath)]
forall a c b. (a -> Cont c b) -> [a] -> Cont c [b]
conts AFilePath -> Cont (F a b) ([Char], AFilePath)
forall a b. AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
showFile
        showFile :: AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
showFile = if [Char] -> Bool -> Bool
argFlag [Char]
"slowshowfile" Bool
True
	           then AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
forall a b. AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
slowShowFile
		   else AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
forall t. AFilePath -> (([Char], AFilePath) -> t) -> t
fastShowFile

	slowShowFile :: AFilePath -> (([Char], AFilePath) -> F a b) -> F a b
slowShowFile AFilePath
path ([Char], AFilePath) -> F a b
c =
	  [Char] -> F a b -> F a b -> F a b
forall a b. [Char] -> F a b -> F a b -> F a b
isDirF (AFilePath -> [Char]
filePath AFilePath
path)
		 (([Char], AFilePath) -> F a b
c ([Char]
file[Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++[Char]
"/",AFilePath
path))
		 (([Char], AFilePath) -> F a b
c ([Char]
file,AFilePath
path))
	  where file :: [Char]
file = AFilePath -> [Char]
pathTail AFilePath
path

        fastShowFile :: AFilePath -> (([Char], AFilePath) -> t) -> t
fastShowFile AFilePath
path ([Char], AFilePath) -> t
c = ([Char], AFilePath) -> t
c (AFilePath -> [Char]
pathTail AFilePath
path,AFilePath
path)

gotoButtonsF :: [(AFilePath -> AFilePath, [Char], lbl)]
-> F Click (AFilePath -> AFilePath)
gotoButtonsF [(AFilePath -> AFilePath, [Char], lbl)]
btns =
   Request
-> (Response -> F Click (AFilePath -> AFilePath))
-> F Click (AFilePath -> AFilePath)
forall a b. Request -> (Response -> F a b) -> F a b
haskellIOF ([Char] -> Request
GetEnv [Char]
"HOME") ((Response -> F Click (AFilePath -> AFilePath))
 -> F Click (AFilePath -> AFilePath))
-> (Response -> F Click (AFilePath -> AFilePath))
-> F Click (AFilePath -> AFilePath)
forall a b. (a -> b) -> a -> b
$ \ Response
homeresp ->
   Bool
-> Bool
-> F Click (AFilePath -> AFilePath)
-> F Click (AFilePath -> AFilePath)
forall a b. Bool -> Bool -> F a b -> F a b
noStretchF Bool
False Bool
True (F Click (AFilePath -> AFilePath)
 -> F Click (AFilePath -> AFilePath))
-> F Click (AFilePath -> AFilePath)
-> F Click (AFilePath -> AFilePath)
forall a b. (a -> b) -> a -> b
$
   Int
-> F Click (AFilePath -> AFilePath)
-> F Click (AFilePath -> AFilePath)
forall a b. Int -> F a b -> F a b
matrixF Int
4 ([F Click (AFilePath -> AFilePath)]
-> F Click (AFilePath -> AFilePath)
forall a b. [F a b] -> F a b
untaggedListF ([F Click (AFilePath -> AFilePath)
forall b. F Click (b -> AFilePath)
rootF,F Click (AFilePath -> AFilePath)
parentF][F Click (AFilePath -> AFilePath)]
-> [F Click (AFilePath -> AFilePath)]
-> [F Click (AFilePath -> AFilePath)]
forall a. [a] -> [a] -> [a]
++Response -> [F Click (AFilePath -> AFilePath)]
forall b. Response -> [F Click (b -> AFilePath)]
homeF Response
homeresp[F Click (AFilePath -> AFilePath)]
-> [F Click (AFilePath -> AFilePath)]
-> [F Click (AFilePath -> AFilePath)]
forall a. [a] -> [a] -> [a]
++[(AFilePath -> AFilePath, [Char], lbl)]
-> [F Click (AFilePath -> AFilePath)]
forall b. [(b, [Char], lbl)] -> [F Click b]
extra [(AFilePath -> AFilePath, [Char], lbl)]
btns))
  where
    rootF :: F Click (b -> AFilePath)
rootF = (b -> AFilePath) -> [Char] -> [Char] -> F Click (b -> AFilePath)
forall lbl b. Graphic lbl => b -> [Char] -> lbl -> F Click b
fButtonF (AFilePath -> b -> AFilePath
forall a b. a -> b -> a
const AFilePath
rootPath) [Char]
"r" [Char]
"/ Root"
    parentF :: F Click (AFilePath -> AFilePath)
parentF = (AFilePath -> AFilePath)
-> [Char] -> [Char] -> F Click (AFilePath -> AFilePath)
forall lbl b. Graphic lbl => b -> [Char] -> lbl -> F Click b
fButtonF (AFilePath -> AFilePath
compactPath(AFilePath -> AFilePath)
-> (AFilePath -> AFilePath) -> AFilePath -> AFilePath
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(AFilePath -> [Char] -> AFilePath)
-> [Char] -> AFilePath -> AFilePath
forall a b c. (a -> b -> c) -> b -> a -> c
flip AFilePath -> [Char] -> AFilePath
extendPath [Char]
"..") [Char]
"p" [Char]
".. Parent"

    homeF :: Response -> [F Click (b -> AFilePath)]
homeF Response
resp=
      case Response
resp of
        Str d :: [Char]
d@(Char
_:[Char]
_) -> [(b -> AFilePath) -> [Char] -> [Char] -> F Click (b -> AFilePath)
forall lbl b. Graphic lbl => b -> [Char] -> lbl -> F Click b
fButtonF (AFilePath -> b -> AFilePath
forall a b. a -> b -> a
const ([Char] -> AFilePath
aFilePath [Char]
d)) [Char]
"h" [Char]
"Home"]
	Response
_ -> []

    fButtonF :: b -> [Char] -> lbl -> F Click b
fButtonF b
f [Char]
k lbl
lbl = b -> Click -> b
forall a b. a -> b -> a
const b
f (Click -> b) -> F Click Click -> F Click b
forall a b e. (a -> b) -> F e a -> F e b
>^=< Customiser (ButtonF lbl) -> lbl -> F Click Click
forall lbl.
Graphic lbl =>
Customiser (ButtonF lbl) -> lbl -> F Click Click
buttonF' ([(ModState, [Char])] -> Customiser (ButtonF lbl)
forall xxx. HasKeys xxx => [(ModState, [Char])] -> Customiser xxx
setKeys [([Modifiers
metaKey],[Char]
k)]) lbl
lbl

    extra :: [(b, [Char], lbl)] -> [F Click b]
extra = ((b, [Char], lbl) -> F Click b)
-> [(b, [Char], lbl)] -> [F Click b]
forall a b. (a -> b) -> [a] -> [b]
map ((b -> [Char] -> lbl -> F Click b) -> (b, [Char], lbl) -> F Click b
forall t1 t2 t3 t4. (t1 -> t2 -> t3 -> t4) -> (t1, t2, t3) -> t4
uncurry3 b -> [Char] -> lbl -> F Click b
forall lbl b. Graphic lbl => b -> [Char] -> lbl -> F Click b
fButtonF)

fileInputF :: F (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
fileInputF = [Char]
"File" [Char]
-> F (Either ([Char] -> [(a, [Char])]) [Char])
     (Either [(a, [Char])] (InputMsg [Char]))
-> F (Either ([Char] -> [(a, [Char])]) [Char])
     (Either [(a, [Char])] (InputMsg [Char]))
forall g c d. Graphic g => g -> F c d -> F c d
`labLeftOfF` F (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
forall a.
F (Either ([Char] -> [(a, [Char])]) [Char])
  (Either [(a, [Char])] (InputMsg [Char]))
completionStringF

pathPartsF :: AFilePath -> ((AFilePath, [Char]) -> F a b) -> F a b
pathPartsF AFilePath
path (AFilePath, [Char]) -> F a b
cont =
    [Char] -> F a b -> F a b -> F a b
forall a b. [Char] -> F a b -> F a b -> F a b
isDirF (AFilePath -> [Char]
filePath AFilePath
path) F a b
yes F a b
no
  where
    yes :: F a b
yes = (AFilePath, [Char]) -> F a b
cont (AFilePath
path,[Char]
"")
    no :: F a b
no = (AFilePath, [Char]) -> F a b
cont (AFilePath -> AFilePath
pathHead AFilePath
path,AFilePath -> [Char]
pathTail AFilePath
path)
    {-
    no  = case path of
            [] -> cont ([],[]) -- not likely to happen, since the root is a dir
	    file:dir -> cont (dir,file)
    -}


--- Candidates for inclusion in the Fudget library:

isDirF :: [Char] -> F a b -> F a b -> F a b
isDirF [Char]
file F a b
yes F a b
no =
  Request -> (Response -> F a b) -> F a b
forall a b. Request -> (Response -> F a b) -> F a b
haskellIOF ([Char] -> Request
StatusFile [Char]
file) ((Response -> F a b) -> F a b) -> (Response -> F a b) -> F a b
forall a b. (a -> b) -> a -> b
$ \ Response
resp ->
  case Response
resp of
    Str (Char
'd':[Char]
_) -> F a b
yes
    Response
_ -> F a b
no

contMapF :: (hi -> (ho -> F hi ho) -> F hi ho) -> F hi ho
contMapF hi -> (ho -> F hi ho) -> F hi ho
f =
  Cont (F hi ho) hi
forall a ho. Cont (F a ho) a
getF Cont (F hi ho) hi -> Cont (F hi ho) hi
forall a b. (a -> b) -> a -> b
$ \ hi
x ->
  hi -> (ho -> F hi ho) -> F hi ho
f hi
x ((ho -> F hi ho) -> F hi ho) -> (ho -> F hi ho) -> F hi ho
forall a b. (a -> b) -> a -> b
$ \ ho
y ->
  ho -> F hi ho -> F hi ho
forall ho hi. ho -> F hi ho -> F hi ho
putF ho
y (F hi ho -> F hi ho) -> F hi ho -> F hi ho
forall a b. (a -> b) -> a -> b
$
  (hi -> (ho -> F hi ho) -> F hi ho) -> F hi ho
contMapF hi -> (ho -> F hi ho) -> F hi ho
f

----

-- #ifdef __NHC__
--startDir = argKey "startdir" "/"  -- hmm. should retreive current directory.
-- #else
startDir :: [Char]
startDir = IO [Char] -> [Char]
forall a. IO a -> a
unsafePerformIO IO [Char]
getCurrentDirectory
-- #endif

{-
 - reloadknapp?
 - alltid absolut path
 - meddelande för att
     välja kataloger
     spara

 - completion och uppnerpilar
 -

 - pixlar kvar i picklistan
-}