packages feed

simpleirc-lens (empty) → 0.1.0.0

raw patch · 5 files changed

+217/−0 lines, 5 filesdep +basedep +bytestringdep +simpleircsetup-changed

Dependencies added: base, bytestring, simpleirc

Files

+ LICENSE view
@@ -0,0 +1,26 @@+Copyright (c) 2014, Ricky Elrod+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are+met:++1. Redistributions of source code must retain the above copyright+   notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright+   notice, this list of conditions and the following disclaimer in the+   documentation and/or other materials provided with the+   distribution.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ simpleirc-lens.cabal view
@@ -0,0 +1,26 @@+name:                simpleirc-lens+version:             0.1.0.0+synopsis:            Lenses for simpleirc types+description:+  Provides lenses for types in the+  <https://hackage.haskell.org/package/simpleirc simpleirc> package without+  depending on <https://hackage.haskell.org/package/lens lens>.+homepage:            https://github.com/relrod/simpleirc-lens+license:             BSD2+license-file:        LICENSE+author:              Ricky Elrod+maintainer:          ricky@elrod.me+copyright:           (C) 2014 Ricky Elrod+category:            Network+build-type:          Simple+cabal-version:       >=1.10++library+  exposed-modules:     Network.SimpleIRC.Core.Lens+                       Network.SimpleIRC.Messages.Lens+  build-depends:       base >= 4 && < 5+                     , bytestring >= 0.10 && < 0.11+                     , simpleirc >= 0.3 && < 0.4+  hs-source-dirs:      src+  default-language:    Haskell2010+  ghc-options:         -Wall
+ src/Network/SimpleIRC/Core/Lens.hs view
@@ -0,0 +1,77 @@+--------------------------------------------------------------------------------+-- |+-- Module      :  Network.SimpleIRC.Core.Lens+-- Copyright   :  (C) 2014 Ricky Elrod+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Ricky Elrod <ricky@elrod.me>+-- Stability   :  provisional+-- Portability :  portable+--+-- This module provides lenses for types in 'Network.SimpleIRC.Core'.+-------------------------------------------------------------------------------++module Network.SimpleIRC.Core.Lens+       ( -- * 'IrcConfig'+         addr, port, nick, pass, username, realname, channels, events,+         ctcpVersion, ctcpTime, ctcpPingTimeoutInterval+       ) where++import Network.SimpleIRC.Core++addr+  :: Functor f => (String -> f String) -> IrcConfig -> f IrcConfig+addr fn (IrcConfig a b c d e f g h i j k) =+  fmap (\a' -> IrcConfig a' b c d e f g h i j k) (fn a)++port :: Functor f => (Int -> f Int) -> IrcConfig -> f IrcConfig+port fn (IrcConfig a b c d e f g h i j k) =+  fmap (\b' -> IrcConfig a b' c d e f g h i j k) (fn b)++nick+  :: Functor f => (String -> f String) -> IrcConfig -> f IrcConfig+nick fn (IrcConfig a b c d e f g h i j k) =+  fmap (\c' -> IrcConfig a b c' d e f g h i j k) (fn c)++pass+  :: Functor f =>+     (Maybe String -> f (Maybe String)) -> IrcConfig -> f IrcConfig+pass fn (IrcConfig a b c d e f g h i j k) =+  fmap (\d' -> IrcConfig a b c d' e f g h i j k) (fn d)++username+  :: Functor f => (String -> f String) -> IrcConfig -> f IrcConfig+username fn (IrcConfig a b c d e f g h i j k) =+  fmap (\e' -> IrcConfig a b c d e' f g h i j k) (fn e)++realname+  :: Functor f => (String -> f String) -> IrcConfig -> f IrcConfig+realname fn (IrcConfig a b c d e f g h i j k) =+  fmap (\f' -> IrcConfig a b c d e f' g h i j k) (fn f)++channels+  :: Functor f =>+     ([String] -> f [String]) -> IrcConfig -> f IrcConfig+channels fn (IrcConfig a b c d e f g h i j k) =+  fmap (\g' -> IrcConfig a b c d e f g' h i j k) (fn g)++events+  :: Functor f =>+     ([IrcEvent] -> f [IrcEvent]) -> IrcConfig -> f IrcConfig+events fn (IrcConfig a b c d e f g h i j k) =+  fmap (\h' -> IrcConfig a b c d e f g h' i j k) (fn h)++ctcpVersion+  :: Functor f => (String -> f String) -> IrcConfig -> f IrcConfig+ctcpVersion fn (IrcConfig a b c d e f g h i j k) =+  fmap (\i' -> IrcConfig a b c d e f g h i' j k) (fn i)++ctcpTime+  :: Functor f =>+     (IO String -> f (IO String)) -> IrcConfig -> f IrcConfig+ctcpTime fn (IrcConfig a b c d e f g h i j k) =+  fmap (\j' -> IrcConfig a b c d e f g h i j' k) (fn j)++ctcpPingTimeoutInterval+  :: Functor f => (Int -> f Int) -> IrcConfig -> f IrcConfig+ctcpPingTimeoutInterval fn (IrcConfig a b c d e f g h i j k) =+  fmap (\k' -> IrcConfig a b c d e f g h i j k') (fn k)
+ src/Network/SimpleIRC/Messages/Lens.hs view
@@ -0,0 +1,86 @@+--------------------------------------------------------------------------------+-- |+-- Module      :  Network.SimpleIRC.Messages.Lens+-- Copyright   :  (C) 2014 Ricky Elrod+-- License     :  BSD-style (see the file LICENSE)+-- Maintainer  :  Ricky Elrod <ricky@elrod.me>+-- Stability   :  provisional+-- Portability :  portable+--+-- This module provides lenses for types in 'Network.SimpleIRC.Messages'.+-------------------------------------------------------------------------------++module Network.SimpleIRC.Messages.Lens+       ( -- * 'IrcMessage'+         nick, user, host, server, code, msg, chan, origin, other, raw+       ) where++import Data.ByteString+import Network.SimpleIRC.Messages++nick+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+nick fn (IrcMessage a b c d e f g h i j) =+  fmap (\a' -> IrcMessage a' b c d e f g h i j) (fn a)++user+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+user fn (IrcMessage a b c d e f g h i j) =+  fmap (\b' -> IrcMessage a b' c d e f g h i j) (fn b)++host+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+host fn (IrcMessage a b c d e f g h i j) =+  fmap (\c' -> IrcMessage a b c' d e f g h i j) (fn c)++server+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+server fn (IrcMessage a b c d e f g h i j) =+  fmap (\d' -> IrcMessage a b c d' e f g h i j) (fn d)++code+  :: Functor f =>+     (ByteString -> f ByteString) -> IrcMessage -> f IrcMessage+code fn (IrcMessage a b c d e f g h i j) =+  fmap (\e' -> IrcMessage a b c d e' f g h i j) (fn e)++msg+  :: Functor f =>+     (ByteString -> f ByteString) -> IrcMessage -> f IrcMessage+msg fn (IrcMessage a b c d e f g h i j) =+  fmap (\f' -> IrcMessage a b c d e f' g h i j) (fn f)++chan+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+chan fn (IrcMessage a b c d e f g h i j) =+  fmap (\g' -> IrcMessage a b c d e f g' h i j) (fn g)++origin+  :: Functor f =>+     (Maybe ByteString -> f (Maybe ByteString))+     -> IrcMessage -> f IrcMessage+origin fn (IrcMessage a b c d e f g h i j) =+  fmap (\h' -> IrcMessage a b c d e f g h' i j) (fn h)++other+  :: Functor f =>+     (Maybe [ByteString] -> f (Maybe [ByteString]))+     -> IrcMessage -> f IrcMessage+other fn (IrcMessage a b c d e f g h i j) =+  fmap (\i' -> IrcMessage a b c d e f g h i' j) (fn i)++raw+  :: Functor f =>+     (ByteString -> f ByteString) -> IrcMessage -> f IrcMessage+raw fn (IrcMessage a b c d e f g h i j) =+  fmap (\j' -> IrcMessage a b c d e f g h i j') (fn j)