mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-17 04:43:47 -07:00
Simplify readLayout, comment on surprising behavior
This commit is contained in:
@@ -144,9 +144,9 @@ instance Show (SomeLayout a) where
|
|||||||
show (SomeLayout l) = show l
|
show (SomeLayout l) = show l
|
||||||
|
|
||||||
readLayout :: [SomeLayout a] -> String -> [(SomeLayout a, String)]
|
readLayout :: [SomeLayout a] -> String -> [(SomeLayout a, String)]
|
||||||
readLayout ls s = case concatMap rl ls of
|
readLayout ls s = take 1 $ concatMap rl ls
|
||||||
(x:_) -> [x]
|
-- We take the first parse only, because multiple matches
|
||||||
[] -> []
|
-- indicate a bad parse.
|
||||||
where rl (SomeLayout x) = map (\(l,s') -> (SomeLayout l,s')) $ rl' x
|
where rl (SomeLayout x) = map (\(l,s') -> (SomeLayout l,s')) $ rl' x
|
||||||
rl' :: Layout l a => l a -> [(l a,String)]
|
rl' :: Layout l a => l a -> [(l a,String)]
|
||||||
rl' _ = reads s
|
rl' _ = reads s
|
||||||
|
Reference in New Issue
Block a user