Commit bf96709f authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[simple-json] remove Argonaut imports which were unused

Argonaut is still there because of generic functions that I don't want
to remove yet. It's also in Spec.
parent b2e22224
Pipeline #1594 failed with stage
......@@ -33,16 +33,6 @@ derive instance Generic DocumentsView _
instance Eq DocumentsView where
eq = genericEq
{-
derive instance Generic DocumentsView _
instance Show DocumentsView where
show = genericShow
instance Argonaut.DecodeJson SearchType where
decodeJson = genericSumDecodeJson
instance Argonaut.EncodeJson SearchType where
encodeJson = genericSumEncodeJson
-}
instance JSON.ReadForeign DocumentsView where
readImpl f = do
{ id, category, date, ngramCount, score, source, title, url } :: { id :: Int | DocumentsViewT } <- JSON.readImpl f
......
......@@ -6,7 +6,6 @@ import Data.Show.Generic (genericShow)
import Simple.JSON as JSON
import Gargantext.Prelude (class Eq, class Show)
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
newtype AddContactParams =
AddContactParams { firstname :: String, lastname :: String }
......
......@@ -18,7 +18,6 @@ import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
......@@ -21,7 +21,6 @@ import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
......@@ -8,8 +8,6 @@ import Simple.JSON.Generics as JSONG
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson, genericEnumDecodeJson, genericEnumEncodeJson)
data UpdateNodeParams = UpdateNodeParamsList { methodList :: Method }
| UpdateNodeParamsGraph { methodGraph :: GraphMetric }
......
......@@ -21,7 +21,6 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
......
......@@ -16,7 +16,6 @@ import Gargantext.Config.REST (get)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Utils.Argonaut (genericSumDecodeJson, genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
here :: R2.Here
......
'use strict';
exports.isNull = function(v) {
return v === null;
};
module Gargantext.Utils.DecodeMaybe where
import Prelude
import Data.Argonaut (class DecodeJson, Json, getFieldOptional)
import Data.Argonaut.Decode.Error (JsonDecodeError(..))
import Data.Either (Either)
import Data.Maybe (Maybe(..), fromMaybe)
import Foreign.Object (Object)
foreign import isNull :: forall a. a -> Boolean
getFieldOptional' :: forall a. DecodeJson a =>
Object Json -> String -> Either JsonDecodeError (Maybe a)
getFieldOptional' o s = (case _ of
Just v -> if isNull v then Nothing else v
Nothing -> Nothing
) <$> (getFieldOptional o s)
infix 7 getFieldOptional' as .?|
getFieldOptionalAsMempty :: forall a. DecodeJson a =>
Monoid a => Object Json -> String -> Either JsonDecodeError a
getFieldOptionalAsMempty o s =
fromMaybe mempty <$> (getFieldOptional' o s)
infix 7 getFieldOptionalAsMempty as .|
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment