-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Lenses for bencoded data. -- -- A port of lens-aeson for bencoding. @package bencoding-lens @version 0.1.0.0 -- | This module exports orphan instances for Ixed -- BValue, Plated BValue, -- Ixed BDictMap, Plated -- BDictMap, Traversable BDictMap, -- FunctorWithIndex BDictMap, -- FoldableWithIndex BDictMap, and -- TraversbaleWithIndex BDictMap. module Data.BEncode.Lens -- | Things that can be treated as a BValue. Instances are provided -- for strict and lazy ByteString as well as BValues -- themselves. class AsBValue t _BValue :: AsBValue t => Prism' t BValue -- |
-- >>> ("i3e" :: ByteString) ^? _BInteger
-- Just 3
--
_BInteger :: AsBValue t => Prism' t BInteger
-- |
-- >>> ("0:" :: ByteString) ^? _BString
-- Just ""
--
--
--
-- >>> ("4:spam" :: ByteString) ^? _BString
-- Just "spam"
--
_BString :: AsBValue t => Prism' t BString
-- |
-- >>> ("le" :: ByteString) ^? _BList
-- Just []
--
--
--
-- >>> ("l4:spam4:eggse" :: ByteString) ^? _BList == Just [BString "spam", BString "eggs"]
-- True
--
_BList :: AsBValue t => Prism' t BList
-- |
-- >>> ("de" :: ByteString) ^? _BDict
-- Just Nil
--
--
--
-- >>> ("d3:cow3:moo4:spam4:eggse" :: ByteString) ^? _BDict == Just (Cons "cow" (BString "moo") (Cons "spam" (BString "eggs") Nil))
-- True
--
_BDict :: AsBValue t => Prism' t BDict
-- |
-- >>> ("d3:cow3:moo4:spam4:eggse" :: ByteString) ^@.. members
-- [("cow",BString "moo"),("spam",BString "eggs")]
--
members :: AsBValue t => IndexedTraversal' BKey t BValue
-- |
-- >>> ("d3:cow3:moo4:spam4:eggse" :: ByteString) ^? key "cow"
-- Just (BString "moo")
--
key :: AsBValue t => BKey -> Traversal' t BValue
-- |
-- >>> ("li0ei1ee" :: ByteString) ^? nth 0
-- Just (BInteger 0)
--
nth :: AsBValue t => Int -> Traversal' t BValue
-- |
-- >>> ("ll1:ae3:cow3:moo4:spam4:eggse" :: ByteString) ^.. values
-- [BList [BString "a"],BString "cow",BString "moo",BString "spam",BString "eggs"]
--
values :: AsBValue t => IndexedTraversal' Int t BValue
instance Data.BEncode.Lens.AsBValue Data.BEncode.Types.BValue
instance Data.BEncode.Lens.AsBValue Data.ByteString.Internal.ByteString
instance Data.BEncode.Lens.AsBValue Data.ByteString.Lazy.Internal.ByteString
instance Data.Traversable.Traversable Data.BEncode.BDict.BDictMap
instance WithIndex.FoldableWithIndex Data.BEncode.BDict.BKey Data.BEncode.BDict.BDictMap
instance WithIndex.FunctorWithIndex Data.BEncode.BDict.BKey Data.BEncode.BDict.BDictMap
instance WithIndex.TraversableWithIndex Data.BEncode.BDict.BKey Data.BEncode.BDict.BDictMap
instance Control.Lens.At.At (Data.BEncode.BDict.BDictMap a)
instance Control.Lens.At.Ixed (Data.BEncode.BDict.BDictMap a)
instance Control.Lens.At.Ixed Data.BEncode.Types.BValue
instance Control.Lens.Plated.Plated Data.BEncode.Types.BValue