Paste: can't compile
Author: | cognominal |
Mode: | haskell |
Date: | Sun, 24 May 2009 12:20:26 |
Plain Text |
bufferStr ∷ EditorM String
bufferStr = do
buffs ← getBufferStack
dm ← withBuffer0 $ getA displayModeA
let (introLn, contentLns) =
case dm of
BDisplayAll → selectBufs "all : buffer and files" $ const True
BDisplayBuffers → selectBufs "buffers only without searches buffers" $ andPreds isMereBuf (notPred searchBuffPred)
BDisplayFiles → selectBufs "files only" isFile
BDisplayModifiedFiles → selectBufs "modified files only" $ andPreds isFile (notPred (isUnchangedBuffer $fst))
BDisplayFound → selectBufs "searches buffer only" $ andPreds isFile searchBuffPred
where
selectBufs introLine aFilter = (filter aFilter map (λb → (b, b ^. identA)) bufs, introLine)
searchBuffPred = λa → (== "find ") (take 5 $ fileName a)
isFile (_, (Right _)) = True
isFile _ = False
isMereBufr = not isFile
fileName (_, ( Left a)) = a
fileName _ = ""
notPred pred = λa → not $ pred a
andPreds pred1 pred2 = λa → pred1 a ∧ pred2 a
let content = intercalate "\n" $ zipWith ( λi s → [ int2indexChar i] ++ " "++ s ) [0..] $
map identString $ contentLns
return $ introLn ++ "\n" ++ content
New Annotation