{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
module Data.Align.Indexed (
AlignWithIndex (..),
) where
import Control.Lens (FunctorWithIndex (imap))
import Data.Vector.Instances ()
import Data.Align
import Data.These
import Control.Applicative (ZipList)
import Data.Hashable (Hashable)
import Data.HashMap.Strict (HashMap)
import Data.IntMap (IntMap)
import Data.Map (Map)
import Data.Sequence (Seq)
import Data.Vector (Vector)
class (FunctorWithIndex i f, Semialign f) => AlignWithIndex i f | f -> i where
ialign :: (i -> These a b -> c) -> f a -> f b -> f c
ialign f a b = imap f (align a b)
instance AlignWithIndex () Maybe
instance AlignWithIndex Int []
instance AlignWithIndex Int ZipList
instance AlignWithIndex Int Seq
instance AlignWithIndex Int IntMap
instance Ord k => AlignWithIndex k (Map k)
instance (Eq k, Hashable k) => AlignWithIndex k (HashMap k)
instance AlignWithIndex Int Vector