Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use core/json instead of argonaut #107

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Prelude

import Control.Monad.Except (ExceptT(..), lift, runExceptT)
import Control.Parallel (parTraverse)
import Data.Argonaut as Json
import Data.Array.NonEmpty (NonEmptyArray)
import Data.Array.NonEmpty as NonEmptyArray
import Data.Bifunctor (lmap)
Expand All @@ -23,6 +22,7 @@ import Data.Tuple (Tuple(..))
import Effect.Aff (Aff, parallel, sequential)
import Effect.Class (liftEffect)
import Effect.Class.Console as Console
import JSON as JSON
import Node.Encoding (Encoding(..))
import Node.FS.Aff as FS
import Node.Glob.Basic (expandGlobs)
Expand All @@ -32,7 +32,7 @@ import PureScript.Backend.Optimizer.Analysis (BackendAnalysis)
import PureScript.Backend.Optimizer.Builder (BuildEnv, buildModules)
import PureScript.Backend.Optimizer.Convert (BackendModule, OptimizationSteps)
import PureScript.Backend.Optimizer.CoreFn (Ann, Ident, Module, ModuleName(..), Qualified)
import PureScript.Backend.Optimizer.CoreFn.Json (decodeModule)
import PureScript.Backend.Optimizer.CoreFn.Json (decodeModule, printJsonDecodeError)
import PureScript.Backend.Optimizer.CoreFn.Sort (emptyPull, pullResult, resumePull, sortModules)
import PureScript.Backend.Optimizer.Directives (parseDirectiveFile)
import PureScript.Backend.Optimizer.Directives.Defaults as Defaults
Expand Down Expand Up @@ -66,7 +66,7 @@ coreFnModulesFromOutput path globs = runExceptT do
readCoreFnModule :: String -> Aff (Either (Tuple FilePath String) (Module Ann))
readCoreFnModule filePath = do
contents <- FS.readTextFile UTF8 filePath
case lmap Json.printJsonDecodeError <<< decodeModule =<< Json.jsonParser contents of
case lmap printJsonDecodeError <<< decodeModule =<< JSON.parse contents of
Left err -> do
pure $ Left $ Tuple filePath err
Right mod ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module PureScript.Backend.Optimizer.Codegen.EcmaScript.Common

import Prelude

import Data.Argonaut as Json
import Data.Array (fold)
import Data.Array as Array
import Data.Enum (fromEnum)
Expand All @@ -31,6 +30,7 @@ import Data.String.Regex.Flags (global, noFlags, unicode)
import Data.String.Regex.Unsafe (unsafeRegex)
import Dodo as Dodo
import Dodo.Common as Dodo.Common
import JSON as JSON
import PureScript.Backend.Optimizer.CoreFn (Comment(..), ModuleName(..))

esModuleName :: forall a. ModuleName -> Dodo.Doc a
Expand Down Expand Up @@ -248,4 +248,4 @@ esTernary a b c =
]

esEscapeString :: String -> String
esEscapeString = Json.stringify <<< Json.fromString
esEscapeString = JSON.print <<< JSON.fromString
16 changes: 16 additions & 0 deletions packages.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,19 @@ in upstream
}
with arrays.version = "v7.2.1"
with ordered-collections.version = "v3.1.0"
with json =
{ dependencies =
[ "prelude"
, "functions"
, "integers"
, "maybe"
, "either"
, "tuples"
, "foldable-traversable"
, "gen"
, "strings"
, "unfoldable"
]
, repo = "https://github.com/purescript/purescript-json.git"
, version = "da4695707d8aacd54e7cbbd54c069509248ff989"
}
3 changes: 1 addition & 2 deletions spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ You can edit this file as you like.
, dependencies =
[ "aff"
, "ansi"
, "argonaut"
, "argparse-basic"
, "arrays"
, "bifunctors"
Expand All @@ -20,8 +19,8 @@ You can edit this file as you like.
, "enums"
, "filterable"
, "foldable-traversable"
, "foreign-object"
, "integers"
, "json"
, "language-cst-parser"
, "lazy"
, "lists"
Expand Down
Loading
Loading