on 53aa204 help sign in
36 lines 1.1 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
23#if MIN_VERSION_hashable(1,4,0)
24instance (Hashable k) => IsMap (HashMap.HashMap k) where
25#else
26instance (Hashable k, Eq k) => IsMap (HashMap.HashMap k) where
27#endif
28 type Key (HashMap.HashMap k) = k
30 mapEmpty = HashMap.empty
31 mapAlterF = HashMap.alterF
32 mapLookup = HashMap.lookup
33 mapInsert = HashMap.insert
34 mapDelete = HashMap.delete
35 mapUnion = HashMap.union
36 mapNull = HashMap.null