diff options
Diffstat (limited to 'src/Rahm/Desktop/Layout')
| -rw-r--r-- | src/Rahm/Desktop/Layout/List.hs (renamed from src/Rahm/Desktop/Layout/LayoutList.hs) | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/Rahm/Desktop/Layout/LayoutList.hs b/src/Rahm/Desktop/Layout/List.hs index 3e72e99..96f9be5 100644 --- a/src/Rahm/Desktop/Layout/LayoutList.hs +++ b/src/Rahm/Desktop/Layout/List.hs @@ -7,9 +7,9 @@ - The indexing uses a type-safe zipper to keep track of the currently-selected - layout. -} -module Rahm.Desktop.Layout.LayoutList ( +module Rahm.Desktop.Layout.List ( LayoutList, - layoutZipper, + layoutList, LCons, LNil, toNextLayout, @@ -156,6 +156,7 @@ data LayoutList l a where deriving instance (LayoutSelect l a) => Show (LayoutList l a) deriving instance (LayoutSelect l a) => Read (LayoutList l a) +-- Cons two LayoutSelect types together. (|:) :: (LayoutSelect t a, LayoutClass l a) => l a -> t a -> LCons l t a (|:) = LCons @@ -164,9 +165,9 @@ infixr 5 |: -- Constructs a LayoutList. This function enforces that the SelectorFor l -- is a 'Sel' type. Essentially this enforces that there must be at least one -- underlying layout, otherwise a LayoutList cannot be constructed. -layoutZipper :: (LayoutSelect l a, SelectorFor l ~ Sel n) => +layoutList :: (LayoutSelect l a, SelectorFor l ~ Sel n) => l a -> LayoutList l a -layoutZipper = LayoutList Sel +layoutList = LayoutList Sel -- The termination of a layout zipper. nil :: LNil a @@ -264,18 +265,6 @@ instance (Show (l a), Typeable l, LayoutSelect l a) => Nothing -> return ([], Nothing) Just (r, la) -> return (r, Just (LayoutList idx la)) - pureLayout (LayoutList idx l) r s = runIdentity $ do - r <- update idx l $ \layout -> return (pureLayout layout r s, Nothing) - case r of - Nothing -> return [] - Just (r, a) -> return r - - emptyLayout (LayoutList idx l) r = do - r <- update idx l $ \layout -> emptyLayout layout r - case r of - Nothing -> return ([], Nothing) - Just (r, la) -> return (r, Just (LayoutList idx la)) - handleMessage (LayoutList idx l) (fromMessage -> Just (NavigateLayout fn)) = return $ Just (LayoutList (fn idx) l) @@ -283,10 +272,6 @@ instance (Show (l a), Typeable l, LayoutSelect l a) => r <- update idx l $ \layout -> ((),) <$> handleMessage layout m return $ LayoutList idx . snd <$> r - pureMessage (LayoutList idx l) m = runIdentity $ do - r <- update idx l $ \layout -> return ((), pureMessage layout m) - return $ LayoutList idx . snd <$> r - description (LayoutList idx l) = runIdentity $ do r <- update idx l $ \l -> return (description l, Nothing) return $ |