{-# LANGUAGE CPP #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
module Language.Haskell.LSP.TH.List where
import qualified Data.Aeson as A
import Data.Aeson.Types
newtype List a = List [a]
deriving (Show,Read,Eq,Ord,Monoid,Functor,Foldable,Traversable)
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