Add a Traversable instance for IdMap, needed in reveal and useful in general to be able to use atAll

This commit is contained in:
Tissevert 2020-03-17 15:25:12 +01:00
parent ba7dd6a690
commit e94a09b3ec
1 changed files with 2 additions and 1 deletions

View File

@ -1,4 +1,5 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE FlexibleContexts #-}
module Data.Id (
Id(..)
@ -34,7 +35,7 @@ newtype Id a = Id {
} deriving (Eq, Enum, Ord, Show)
newtype IdMap a b = IdMap {
intMap :: IntMap b
} deriving (Show, Functor, Semigroup, Monoid, Foldable)
} deriving (Show, Functor, Semigroup, Monoid, Foldable, Traversable)
type Indexed a = IdMap a a
at :: IdMap a b -> Id a -> b