{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveGeneric #-}
module Language.Haskell.LSP.Types.List where
import Control.DeepSeq
import qualified Data.Aeson as A
import Data.Aeson.Types
import GHC.Generics
newtype List a = List [a]
deriving (Show,Read,Eq,Ord,Monoid,Functor,Foldable,Traversable,Generic)
instance NFData a => NFData (List a)
instance (A.ToJSON a) => A.ToJSON (List a) where
toJSON (List ls) = toJSON ls
instance (A.FromJSON a) => A.FromJSON (List a) where
parseJSON A.Null = return (List [])
parseJSON v = List <$> parseJSON v
#if __GLASGOW_HASKELL__ >= 804
instance Semigroup (List a) where
(<>) = mappend
#endif