on fe28607 help sign in
32 lines 1.0 kB history raw
1{-# OPTIONS_GHC -Wno-orphans #-}
3-- |
4-- Module : Streamly.Internal.Data.IsMap.HashMap
5-- Copyright : (c) 2022 Composewell Technologies
6-- License : BSD-3-Clause
7-- Maintainer : streamly@composewell.com
8-- Stability : experimental
9-- Portability : GHC
10--
11-- Adds an orphan HashMap instance for the IsMap type class from streamly-core
12-- package. This is useful for various combinators that use a map type. We
13-- cannot define this in streamly-core as it adds several non-boot library
14-- dependencies on streamly-core.
16module Streamly.Internal.Data.IsMap.HashMap () where
18import Data.Hashable (Hashable)
19import Streamly.Internal.Data.IsMap (IsMap(..))
21import qualified Data.HashMap.Strict as HashMap
23instance (Hashable k, Eq k) => IsMap (HashMap.HashMap k) where
24 type Key (HashMap.HashMap k) = k
26 mapEmpty = HashMap.empty
27 mapAlterF = HashMap.alterF
28 mapLookup = HashMap.lookup
29 mapInsert = HashMap.insert
30 mapDelete = HashMap.delete
31 mapUnion = HashMap.union
32 mapNull = HashMap.null