1{-# LANGUAGE FlexibleInstances #-}
4 -- Module : Gen.Types.Map
5-- Copyright : (c) 2013-2015 Brendan Hay
6-- License : This Source Code Form is subject to the terms of
7-- the Mozilla Public License, v. 2.0.
8-- A copy of the MPL can be found in the LICENSE file or
9-- you can obtain it at http://mozilla.org/MPL/2.0/.
10-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11-- Stability : provisional
12-- Portability : non-portable (GHC extensions)
14module Gen.Types.Map where
20import qualified Data.HashMap.Strict as Map
22import Data.Text (Text)
26vMapMaybe :: (Eq k, Hashable k)
30vMapMaybe f = runIdentity . kvTraverseMaybe (const (pure . f))
32kvTraverseMaybe :: (Applicative f, Eq k, Hashable k)
33 => (k -> a -> f (Maybe b))
36kvTraverseMaybe f = fmap (Map.map fromJust . Map.filter isJust)
37 . Map.traverseWithKey f
39class (Hashable a, Eq a) => TextKey a where
42instance (TextKey k, FromJSON v) => FromJSON (Map k v) where
43 parseJSON = fmap (Map.fromList . map (first toKey) . Map.toList)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list