{-# LANGUAGE BangPatterns #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE MagicHash #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UnboxedTuples #-} module Data.Map.Subset.Strict.Unlifted ( I.Map , singleton , lookup , toList , fromList ) where import Prelude hiding (lookup) import Data.Map.Subset.Strict.Internal (Map) import Data.Set.Unlifted.Internal (Set(..)) import Data.Bifunctor (first) import Data.Semigroup (Semigroup) import Data.Primitive.Unlifted.Class (PrimUnlifted) import qualified Data.Map.Subset.Strict.Internal as I singleton :: (PrimUnlifted k, Monoid v, Eq v) => Set k -> v -> Map k v singleton :: forall k v. (PrimUnlifted k, Monoid v, Eq v) => Set k -> v -> Map k v singleton (Set Set UnliftedArray k s) v v = forall v (arr :: * -> *) k. (Eq v, Contiguous arr, Element arr k) => Set arr k -> v -> Map k v I.singleton Set UnliftedArray k s v v lookup :: (Ord k, PrimUnlifted k) => Set k -> Map k v -> Maybe v lookup :: forall k v. (Ord k, PrimUnlifted k) => Set k -> Map k v -> Maybe v lookup (Set Set UnliftedArray k s) Map k v m = forall (arr :: * -> *) k v. (Ord k, Contiguous arr, Element arr k) => Set arr k -> Map k v -> Maybe v I.lookup Set UnliftedArray k s Map k v m toList :: PrimUnlifted k => Map k v -> [(Set k,v)] toList :: forall k v. PrimUnlifted k => Map k v -> [(Set k, v)] toList = forall a b. (a -> b) -> [a] -> [b] map (forall (p :: * -> * -> *) a b c. Bifunctor p => (a -> b) -> p a c -> p b c first forall a. Set UnliftedArray a -> Set a Set) forall b c a. (b -> c) -> (a -> b) -> a -> c . forall (arr :: * -> *) k v. (Contiguous arr, Element arr k) => Map k v -> [(Set arr k, v)] I.toList fromList :: (Ord k, PrimUnlifted k, Eq v, Semigroup v) => [(Set k,v)] -> Map k v fromList :: forall k v. (Ord k, PrimUnlifted k, Eq v, Semigroup v) => [(Set k, v)] -> Map k v fromList = forall (arr :: * -> *) k v. (Contiguous arr, Element arr k, Ord k, Eq v) => [(Set arr k, v)] -> Map k v I.fromList forall b c a. (b -> c) -> (a -> b) -> a -> c . forall a b. (a -> b) -> [a] -> [b] map (forall (p :: * -> * -> *) a b c. Bifunctor p => (a -> b) -> p a c -> p b c first forall a. Set a -> Set UnliftedArray a getSet)