{-# OPTIONS_GHC -Wno-unused-imports #-}
{-# OPTIONS_GHC -Wno-unused-matches #-}
{-# OPTIONS_GHC -Wno-deprecations #-}
module Language.LSP.Protocol.Internal.Types.NotebookDocument where
import Control.DeepSeq
import Data.Hashable
import GHC.Generics
import Language.LSP.Protocol.Utils.Misc
import Prettyprinter
import qualified Data.Aeson
import qualified Data.Aeson as Aeson
import qualified Data.Row.Aeson as Aeson
import qualified Data.Row.Hashable as Hashable
import qualified Data.Text
import qualified Language.LSP.Protocol.Internal.Types.NotebookCell
import qualified Language.LSP.Protocol.Types.Common
import qualified Language.LSP.Protocol.Types.Uri
data NotebookDocument = NotebookDocument
{
NotebookDocument -> Uri
_uri :: Language.LSP.Protocol.Types.Uri.Uri
,
NotebookDocument -> Text
_notebookType :: Data.Text.Text
,
NotebookDocument -> Int32
_version :: Language.LSP.Protocol.Types.Common.Int32
,
NotebookDocument -> Maybe Object
_metadata :: (Maybe Data.Aeson.Object)
,
NotebookDocument -> [NotebookCell]
_cells :: [Language.LSP.Protocol.Internal.Types.NotebookCell.NotebookCell]
}
deriving stock (Int -> NotebookDocument -> ShowS
[NotebookDocument] -> ShowS
NotebookDocument -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NotebookDocument] -> ShowS
$cshowList :: [NotebookDocument] -> ShowS
show :: NotebookDocument -> String
$cshow :: NotebookDocument -> String
showsPrec :: Int -> NotebookDocument -> ShowS
$cshowsPrec :: Int -> NotebookDocument -> ShowS
Show, NotebookDocument -> NotebookDocument -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NotebookDocument -> NotebookDocument -> Bool
$c/= :: NotebookDocument -> NotebookDocument -> Bool
== :: NotebookDocument -> NotebookDocument -> Bool
$c== :: NotebookDocument -> NotebookDocument -> Bool
Eq, Eq NotebookDocument
NotebookDocument -> NotebookDocument -> Bool
NotebookDocument -> NotebookDocument -> Ordering
NotebookDocument -> NotebookDocument -> NotebookDocument
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: NotebookDocument -> NotebookDocument -> NotebookDocument
$cmin :: NotebookDocument -> NotebookDocument -> NotebookDocument
max :: NotebookDocument -> NotebookDocument -> NotebookDocument
$cmax :: NotebookDocument -> NotebookDocument -> NotebookDocument
>= :: NotebookDocument -> NotebookDocument -> Bool
$c>= :: NotebookDocument -> NotebookDocument -> Bool
> :: NotebookDocument -> NotebookDocument -> Bool
$c> :: NotebookDocument -> NotebookDocument -> Bool
<= :: NotebookDocument -> NotebookDocument -> Bool
$c<= :: NotebookDocument -> NotebookDocument -> Bool
< :: NotebookDocument -> NotebookDocument -> Bool
$c< :: NotebookDocument -> NotebookDocument -> Bool
compare :: NotebookDocument -> NotebookDocument -> Ordering
$ccompare :: NotebookDocument -> NotebookDocument -> Ordering
Ord, forall x. Rep NotebookDocument x -> NotebookDocument
forall x. NotebookDocument -> Rep NotebookDocument x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NotebookDocument x -> NotebookDocument
$cfrom :: forall x. NotebookDocument -> Rep NotebookDocument x
Generic)
deriving anyclass (NotebookDocument -> ()
forall a. (a -> ()) -> NFData a
rnf :: NotebookDocument -> ()
$crnf :: NotebookDocument -> ()
NFData, Eq NotebookDocument
Int -> NotebookDocument -> Int
NotebookDocument -> Int
forall a. Eq a -> (Int -> a -> Int) -> (a -> Int) -> Hashable a
hash :: NotebookDocument -> Int
$chash :: NotebookDocument -> Int
hashWithSalt :: Int -> NotebookDocument -> Int
$chashWithSalt :: Int -> NotebookDocument -> Int
Hashable)
deriving forall ann. [NotebookDocument] -> Doc ann
forall ann. NotebookDocument -> Doc ann
forall a.
(forall ann. a -> Doc ann)
-> (forall ann. [a] -> Doc ann) -> Pretty a
prettyList :: forall ann. [NotebookDocument] -> Doc ann
$cprettyList :: forall ann. [NotebookDocument] -> Doc ann
pretty :: forall ann. NotebookDocument -> Doc ann
$cpretty :: forall ann. NotebookDocument -> Doc ann
Pretty via (ViaJSON NotebookDocument)
instance Aeson.ToJSON NotebookDocument where
toJSON :: NotebookDocument -> Value
toJSON (NotebookDocument Uri
arg0 Text
arg1 Int32
arg2 Maybe Object
arg3 [NotebookCell]
arg4) = [Pair] -> Value
Aeson.object forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat forall a b. (a -> b) -> a -> b
$ [[Key
"uri" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Uri
arg0]
,[Key
"notebookType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Text
arg1]
,[Key
"version" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= Int32
arg2]
,String
"metadata" forall kv v. (KeyValue kv, ToJSON v) => String -> Maybe v -> [kv]
Language.LSP.Protocol.Types.Common..=? Maybe Object
arg3
,[Key
"cells" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Aeson..= [NotebookCell]
arg4]]
instance Aeson.FromJSON NotebookDocument where
parseJSON :: Value -> Parser NotebookDocument
parseJSON = forall a. String -> (Object -> Parser a) -> Value -> Parser a
Aeson.withObject String
"NotebookDocument" forall a b. (a -> b) -> a -> b
$ \Object
arg -> Uri
-> Text
-> Int32
-> Maybe Object
-> [NotebookCell]
-> NotebookDocument
NotebookDocument forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"uri" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"notebookType" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"version" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Aeson..:! Key
"metadata" forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Object
arg forall a. FromJSON a => Object -> Key -> Parser a
Aeson..: Key
"cells"