Files
loop/src/NewInt.hs
T

32 lines
988 B
Haskell

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DerivingStrategies #-}
module NewInt where
--import qualified Data.IntSet as IS
import qualified Data.IntMap.Strict as IM
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
newtype NewInt a = NInt { _unNInt :: Int}
deriving newtype (Eq,Ord,Show,Num,Read,Integral,Real,Enum)
newtype NewIntMap a b = NIntMap { _unNIntMap :: IM.IntMap b}
deriving newtype (Monoid,Semigroup)
deriving (Eq,Ord,Show,Read)
--instance Ixed (NewIntMap (NewInt a)) where
-- type Index (NewIntMap (NewInt a)) = NewInt a
-- type Index (NewIntMap (NewInt a)) = NewInt a
-- ix :: (NewInt a) -> IndexedTraversal' (NewIntMap (NewInt a))
-- ix (NInt k) (NewIntMap m) = NIntMap <$> ix k m
makeLenses ''NewInt
makeLenses ''NewIntMap
deriveJSON defaultOptions ''NewInt
deriveJSON defaultOptions ''NewIntMap