"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "libs/types-common/src/Data/IdMapping.hs" between
wire-server-2020-06-10.tar.gz and wire-server-2020-06-19.tar.gz

About: Wire (server) offers end-to-end encrypted messaging, file-sharing, video and voice calls, and guest rooms for external communication (back-end server).

IdMapping.hs  (wire-server-2020-06-10):IdMapping.hs  (wire-server-2020-06-19)
skipping to change at line 30 skipping to change at line 30
module Data.IdMapping where module Data.IdMapping where
import Data.Id import Data.Id
import Data.Qualified import Data.Qualified
import Imports import Imports
import Test.QuickCheck (Arbitrary (arbitrary), oneof) import Test.QuickCheck (Arbitrary (arbitrary), oneof)
data MappedOrLocalId a data MappedOrLocalId a
= Mapped (IdMapping a) = Mapped (IdMapping a)
| Local (Id a) | Local (Id a)
deriving (Show) deriving stock (Eq, Ord, Show)
opaqueIdFromMappedOrLocal :: MappedOrLocalId a -> Id (Opaque a) opaqueIdFromMappedOrLocal :: MappedOrLocalId a -> Id (Opaque a)
opaqueIdFromMappedOrLocal = \case opaqueIdFromMappedOrLocal = \case
Local localId -> makeIdOpaque localId Local localId -> makeIdOpaque localId
Mapped IdMapping {idMappingLocal} -> makeMappedIdOpaque idMappingLocal Mapped IdMapping {idMappingLocal} -> makeMappedIdOpaque idMappingLocal
partitionMappedOrLocalIds :: Foldable f => f (MappedOrLocalId a) -> ([Id a], [Id Mapping a]) partitionMappedOrLocalIds :: Foldable f => f (MappedOrLocalId a) -> ([Id a], [Id Mapping a])
partitionMappedOrLocalIds = foldMap $ \case partitionMappedOrLocalIds = foldMap $ \case
Mapped mapping -> (mempty, [mapping]) Mapped mapping -> (mempty, [mapping])
Local localId -> ([localId], mempty) Local localId -> ([localId], mempty)
data IdMapping a = IdMapping data IdMapping a = IdMapping
{ idMappingLocal :: Id (Mapped a), { idMappingLocal :: Id (Mapped a),
idMappingGlobal :: Qualified (Id a) idMappingGlobal :: Qualified (Id (Remote a))
} }
deriving (Show) deriving stock (Eq, Ord, Show)
---------------------------------------------------------------------- ----------------------------------------------------------------------
-- ARBITRARY -- ARBITRARY
instance Arbitrary a => Arbitrary (MappedOrLocalId a) where instance Arbitrary a => Arbitrary (MappedOrLocalId a) where
arbitrary = oneof [Mapped <$> arbitrary, Local <$> arbitrary] arbitrary = oneof [Mapped <$> arbitrary, Local <$> arbitrary]
instance Arbitrary a => Arbitrary (IdMapping a) where instance Arbitrary a => Arbitrary (IdMapping a) where
arbitrary = IdMapping <$> arbitrary <*> arbitrary arbitrary = IdMapping <$> arbitrary <*> arbitrary
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)