{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Optics.Each
(
Each(..)
) where
import qualified Data.ByteString as SB
import qualified Data.ByteString.Lazy as LB
import Data.HashMap.Lazy (HashMap)
import qualified Data.HashMap.Lazy as HashMap
import Data.Int (Int64)
import qualified Data.Text as ST
import qualified Data.Text.Lazy as LT
import Data.Text.Optics (text)
import Data.Vector.Generic.Optics (vectorTraverse)
import Data.Vector.Primitive (Prim)
import Data.Vector.Storable (Storable)
import Data.Vector.Unboxed (Unbox)
import Data.Word (Word8)
import qualified Data.Vector as V
import qualified Data.Vector.Primitive as VP
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
import Optics.Core
import Optics.Indexed ()
import Optics.Extra.Internal.ByteString
instance k ~ k' => Each k (HashMap k a) (HashMap k' b) a b where
each :: IxTraversal k (HashMap k a) (HashMap k' b) a b
each = IxTraversalVL k (HashMap k a) (HashMap k' b) a b
-> IxTraversal k (HashMap k a) (HashMap k' b) a b
forall i s t a b. IxTraversalVL i s t a b -> IxTraversal i s t a b
itraversalVL IxTraversalVL k (HashMap k a) (HashMap k' b) a b
forall (f :: * -> *) k v1 v2.
Applicative f =>
(k -> v1 -> f v2) -> HashMap k v1 -> f (HashMap k v2)
HashMap.traverseWithKey
{-# INLINE[1] each #-}
instance Each Int (V.Vector a) (V.Vector b) a b where
each :: IxTraversal Int (Vector a) (Vector b) a b
each = IxTraversal Int (Vector a) (Vector b) a b
forall (v :: * -> *) (w :: * -> *) a b.
(Vector v a, Vector w b) =>
IxTraversal Int (v a) (w b) a b
vectorTraverse
{-# INLINE[1] each #-}
instance (Prim a, Prim b) => Each Int (VP.Vector a) (VP.Vector b) a b where
each :: IxTraversal Int (Vector a) (Vector b) a b
each = IxTraversal Int (Vector a) (Vector b) a b
forall (v :: * -> *) (w :: * -> *) a b.
(Vector v a, Vector w b) =>
IxTraversal Int (v a) (w b) a b
vectorTraverse
{-# INLINE[1] each #-}
instance (Storable a, Storable b) => Each Int (VS.Vector a) (VS.Vector b) a b where
each :: IxTraversal Int (Vector a) (Vector b) a b
each = IxTraversal Int (Vector a) (Vector b) a b
forall (v :: * -> *) (w :: * -> *) a b.
(Vector v a, Vector w b) =>
IxTraversal Int (v a) (w b) a b
vectorTraverse
{-# INLINE[1] each #-}
instance (Unbox a, Unbox b ) => Each Int (VU.Vector a) (VU.Vector b) a b where
each :: IxTraversal Int (Vector a) (Vector b) a b
each = IxTraversal Int (Vector a) (Vector b) a b
forall (v :: * -> *) (w :: * -> *) a b.
(Vector v a, Vector w b) =>
IxTraversal Int (v a) (w b) a b
vectorTraverse
{-# INLINE[1] each #-}
instance (a ~ Char, b ~ Char) => Each Int ST.Text ST.Text a b where
each :: IxTraversal Int Text Text a b
each = IxTraversal Int Text Text a b
forall t. IsText t => IxTraversal' Int t Char
text
{-# INLINE[1] each #-}
instance (a ~ Char, b ~ Char) => Each Int LT.Text LT.Text a b where
each :: IxTraversal Int Text Text a b
each = IxTraversal Int Text Text a b
forall t. IsText t => IxTraversal' Int t Char
text
{-# INLINE[1] each #-}
instance (a ~ Word8, b ~ Word8) => Each Int64 SB.ByteString SB.ByteString a b where
each :: IxTraversal Int64 ByteString ByteString a b
each = IxTraversal Int64 ByteString ByteString a b
IxTraversal' Int64 ByteString Word8
traversedStrictTree
{-# INLINE[1] each #-}
instance (a ~ Word8, b ~ Word8) => Each Int64 LB.ByteString LB.ByteString a b where
each :: IxTraversal Int64 ByteString ByteString a b
each = IxTraversal Int64 ByteString ByteString a b
IxTraversal' Int64 ByteString Word8
traversedLazy
{-# INLINE[1] each #-}