packages feed

rasa-ext-status-bar (empty) → 0.1.0.0

raw patch · 4 files changed

+109/−0 lines, 4 filesdep +basedep +data-defaultdep +lenssetup-changed

Dependencies added: base, data-default, lens, rasa, text

Files

+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License++Copyright (c) 2016 Chris Penner++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in+all copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+THE SOFTWARE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ rasa-ext-status-bar.cabal view
@@ -0,0 +1,32 @@+name:                rasa-ext-status-bar+version:             0.1.0.0+synopsis:            Rasa Ext for populating status-bar+description:         Rasa Ext for populating status-status-bar+homepage:            https://github.com/ChrisPenner/rasa/+license:             MIT+license-file:        LICENSE+author:              Chris Penner+maintainer:          christopher.penner@gmail.com+copyright:           2016 Chris Penner+category:            Extension+build-type:          Simple+-- extra-source-files:+cabal-version:       >=1.10++library+  hs-source-dirs:      src+  exposed-modules:+                       Rasa.Ext.StatusBar++  build-depends:       base >= 4.7 && < 5+                     , rasa+                     , data-default+                     , lens+                     , text+  default-language:    Haskell2010++  ghc-options:         -Wall++source-repository head+  type:     git+  location: https://github.com/ChrisPenner/rasa
+ src/Rasa/Ext/StatusBar.hs view
@@ -0,0 +1,54 @@+{-# LANGUAGE TemplateHaskell #-}++module Rasa.Ext.StatusBar+  ( leftStatus+  , centerStatus+  , rightStatus+  , statusBar+  , left+  , center+  , right+  , StatusBar(..)+  ) where++import Control.Lens++import Data.Typeable+import Data.Default++import qualified Data.Text as T++import Rasa.Ext++data StatusBar = StatusBar+  { _left :: [T.Text]+  , _center :: [T.Text]+  , _right :: [T.Text]+  } deriving (Typeable, Show, Eq)++makeLenses ''StatusBar++instance Default StatusBar where+  def = StatusBar+    { _left=[]+    , _center=[]+    , _right=[]+    }++statusBar :: Scheduler ()+statusBar = beforeEvent $ bufDo clearStatus++clearStatus :: BufAction ()+clearStatus = do+  bufExt.left .= []+  bufExt.center .= []+  bufExt.right .= []++leftStatus :: T.Text -> BufAction ()+leftStatus txt = bufExt.left %= (txt:)++centerStatus :: T.Text -> BufAction ()+centerStatus txt = bufExt.center %= (txt:)++rightStatus :: T.Text -> BufAction ()+rightStatus txt = bufExt.right %= (txt:)