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

Update purescript dependency #80

Merged
merged 5 commits into from
Jul 19, 2022
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: haskell/actions/setup@v1
id: setup-haskell
with:
ghc-version: 8.10.7
ghc-version: 9.2.3
cabal-version: 3.6.2.0

- name: Setup cabal path (posix)
Expand Down
2 changes: 1 addition & 1 deletion app/Command/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ entryPointOpt = Opts.argument (Opts.auto >>= checkIfQualified) $
Opts.metavar "entry-point"
<> Opts.help "Qualified identifier or a module name (it may be prefixed with `ident:` or `module:`). All code which is not a transitive dependency of an entry point (or any exported identifier from a give module) will be removed. You can pass multiple entry points."
where
checkIfQualified (EntryPoint q@(P.Qualified Nothing _)) = fail $
checkIfQualified (EntryPoint q@(P.Qualified (P.BySourcePos _) _)) = fail $
"not a qualified indentifier: '" ++ T.unpack (P.showQualified P.runIdent q) ++ "'"
checkIfQualified e = return e

Expand Down
15 changes: 7 additions & 8 deletions app/Command/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import Data.Aeson.Internal (JSONPath)
import qualified Data.Aeson.Internal as A
import Data.Aeson.Parser (eitherDecodeWith, json)
import qualified Data.ByteString.Lazy as BSL
import qualified Data.ByteString.Lazy.Char8 as BSL.Char8 (unpack)
import qualified Data.ByteString.Lazy.UTF8 as BU8
import Data.Bool (bool)
import Data.Either (lefts, rights, partitionEithers)
Expand Down Expand Up @@ -145,19 +144,19 @@ formatDCEAppError opts _ (ParseErrors errs) =
0 -> []
x -> ["... (" <> T.pack (show x) <> " more)"]
in sformat
(string%": Failed parsing:\n "%stext)
(string % ": Failed parsing:\n " % stext)
(DCE.colorString DCE.errorColor "Error")
(T.intercalate "\n\t" errs')
formatDCEAppError _ _ (NoInputs path)
= sformat
(stext%": No inputs found under "%string%" directory.\n"
%" Please run `purs compile --codegen corefn ..` or"
%"`pulp build -- --codegen corefn`")
(stext % ": No inputs found under " % string % " directory.\n"
% " Please run `purs compile --codegen corefn ..` or"
% "`pulp build -- --codegen corefn`")
(DCE.colorText DCE.errorColor "Error")
(DCE.colorString DCE.codeColor path)
formatDCEAppError _ _ (InputNotDirectory path)
= sformat
(stext%": Directory "%string%" does not exists.")
(stext % ": Directory "%string%" does not exists.")
(DCE.colorText DCE.errorColor "Error")
(DCE.colorString DCE.codeColor path)
formatDCEAppError _ relPath (DCEAppError err)
Expand Down Expand Up @@ -191,7 +190,7 @@ getEntryPoints mods = go []

fnd :: P.Qualified P.Ident -> [CoreFn.Module CoreFn.Ann] -> Bool
fnd _ [] = False
fnd qi@(P.Qualified (Just mn) i) ([email protected]{ CoreFn.moduleName } : ms)
fnd qi@(P.Qualified (P.ByModuleName mn) i) ([email protected]{ CoreFn.moduleName } : ms)
= if moduleName == mn && i `elem` (allExports pModule)
then True
else fnd qi ms
Expand Down Expand Up @@ -270,7 +269,7 @@ dceCommand Options { optEntryPoints
case moduleName `M.lookup` foreigns of
-- run `runForeignModuleDeadCodeElimination`
Just path | optForeign -> do
jsCode <- BSL.Char8.unpack <$> BSL.readFile path
jsCode <- BU8.toString <$> BSL.readFile path
case JS.parseModule jsCode path of
Left _ -> return ()
Right (JS.JSAstModule items ann) ->
Expand Down
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
index-state: 2022-06-23T22:25:02Z
index-state: 2022-07-19T00:35:07Z
packages: .
84 changes: 43 additions & 41 deletions cabal.project.freeze
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
active-repositories: hackage.haskell.org:merge
constraints: any.Cabal ==3.2.1.0,
constraints: any.Cabal ==3.6.3.0,
Cabal -bundled-binary-generic,
any.Glob ==0.10.2,
any.HUnit ==1.6.2.0,
Expand All @@ -8,8 +8,8 @@ constraints: any.Cabal ==3.2.1.0,
QuickCheck -old-random +templatehaskell,
any.StateVar ==1.2.2,
any.adjunctions ==4.4.1,
any.aeson ==1.5.6.0,
aeson -bytestring-builder -cffi -developer -fast,
any.aeson ==2.0.3.0,
aeson -cffi +ordered-keymap,
any.aeson-better-errors ==0.9.1.1,
any.aeson-pretty ==0.8.9,
aeson-pretty -lib-only,
Expand All @@ -25,21 +25,20 @@ constraints: any.Cabal ==3.2.1.0,
any.attoparsec ==0.14.4,
attoparsec -developer,
any.auto-update ==0.1.6,
any.base ==4.14.3.0,
any.base-compat ==0.11.2,
any.base-compat-batteries ==0.11.2,
any.base ==4.16.2.0,
any.base-compat ==0.12.1,
any.base-compat-batteries ==0.12.1,
any.base-orphans ==0.8.6,
any.basement ==0.0.14,
any.bifunctors ==5.5.12,
bifunctors +semigroups +tagged,
any.binary ==0.8.8.0,
any.binary ==0.8.9.0,
any.blaze-builder ==0.4.2.2,
any.blaze-html ==0.9.1.2,
any.blaze-markup ==0.8.2.8,
any.bower-json ==1.0.0.1,
any.bower-json ==1.1.0.0,
any.boxes ==0.1.5,
any.bytestring ==0.10.12.0,
any.cabal-doctest ==1.0.9,
any.bytestring ==0.11.3.1,
any.call-stack ==0.4.0,
any.case-insensitive ==1.2.1.0,
any.cborg ==0.2.7.0,
Expand All @@ -59,7 +58,7 @@ constraints: any.Cabal ==3.2.1.0,
any.containers ==0.6.5.1,
any.contravariant ==1.5.5,
contravariant +semigroups +statevar +tagged,
any.cryptonite ==0.29,
any.cryptonite ==0.30,
cryptonite -check_alignment +integer-gmp -old_toolchain_inliner +support_aesni +support_deepseq -support_pclmuldq +support_rdrand -support_sse +use_target_attributes,
any.css-text ==0.1.3.0,
any.data-default ==0.7.1.1,
Expand All @@ -69,8 +68,8 @@ constraints: any.Cabal ==3.2.1.0,
any.data-default-instances-old-locale ==0.0.1,
any.data-fix ==0.3.2,
any.data-ordlist ==0.4.7.0,
any.deepseq ==1.4.4.0,
any.directory ==1.3.6.0,
any.deepseq ==1.4.6.1,
any.directory ==1.3.6.2,
any.distributive ==0.6.2.1,
distributive +semigroups +tagged,
any.dlist ==1.0,
Expand All @@ -83,17 +82,18 @@ constraints: any.Cabal ==3.2.1.0,
any.exceptions ==0.10.4,
any.fast-logger ==3.1.1,
any.file-embed ==0.0.15.0,
any.filepath ==1.4.2.1,
any.filepath ==1.4.2.2,
any.formatting ==7.1.3,
any.free ==5.1.8,
any.free ==5.1.9,
any.fsnotify ==0.3.0.1,
any.ghc-boot-th ==8.10.7,
any.ghc-prim ==0.6.1,
any.ghc-bignum ==1.2,
any.ghc-boot-th ==9.2.3,
any.ghc-prim ==0.8.0,
any.gitrev ==1.3.1,
any.half ==0.3.1,
any.happy ==1.20.0,
any.hashable ==1.3.5.0,
hashable +integer-gmp -random-initial-seed,
any.hashable ==1.4.0.2,
hashable +containers +integer-gmp -random-initial-seed,
any.haskeline ==0.8.2,
haskeline +examples +terminfo,
any.hinotify ==0.4.1,
Expand All @@ -106,18 +106,18 @@ constraints: any.Cabal ==3.2.1.0,
any.http-types ==0.12.3,
any.indexed-traversable ==0.1.2,
any.indexed-traversable-instances ==0.1.1,
any.integer-gmp ==1.0.3.0,
any.integer-gmp ==1.1,
any.integer-logarithms ==1.0.3.1,
integer-logarithms -check-bounds +integer-gmp,
any.invariant ==0.5.6,
any.kan-extensions ==5.2.4,
any.invariant ==0.6,
any.kan-extensions ==5.2.5,
any.language-javascript ==0.7.0.0,
any.lens ==4.19.2,
lens -benchmark-uniplate -dump-splices +inlining -j -old-inline-pragmas -safe +test-doctests +test-hunit +test-properties +test-templates +trustworthy,
any.lens ==5.1.1,
lens -benchmark-uniplate -dump-splices +inlining -j +test-hunit +test-properties +test-templates +trustworthy,
any.lifted-async ==0.10.2.2,
any.lifted-base ==0.2.3.12,
any.memory ==0.15.0,
memory +support_basement +support_bytestring +support_deepseq +support_foundation,
any.memory ==0.17.0,
memory +support_bytestring +support_deepseq,
any.monad-control ==1.0.3.1,
any.monad-logger ==0.3.36,
monad-logger +template_haskell,
Expand All @@ -135,35 +135,35 @@ constraints: any.Cabal ==3.2.1.0,
any.newtype ==0.2.2.0,
any.old-locale ==1.0.0.7,
any.old-time ==1.1.0.3,
any.optparse-applicative ==0.16.1.0,
any.optparse-applicative ==0.17.0.0,
optparse-applicative +process,
any.parallel ==3.2.2.0,
any.parsec ==3.1.14.0,
any.parsec ==3.1.15.0,
any.pattern-arrows ==0.0.2,
any.pretty ==1.1.3.6,
any.primitive ==0.7.3.0,
any.process ==1.6.13.1,
any.profunctors ==5.6.2,
any.protolude ==0.3.2,
any.purescript ==0.15.2,
any.purescript ==0.15.4,
purescript -release,
any.quickcheck-io ==0.2.0,
any.random ==1.2.1.1,
any.reflection ==2.1.6,
reflection -slow +template-haskell,
any.regex-base ==0.94.0.2,
any.regex-tdfa ==1.3.1.2,
any.regex-tdfa ==1.3.2,
regex-tdfa -force-o2,
any.resourcet ==1.2.5,
any.rts ==1.0.1,
any.resourcet ==1.2.6,
any.rts ==1.0.2,
any.safe ==0.3.19,
any.scientific ==0.3.7.0,
scientific -bytestring-builder -integer-simple,
any.semialign ==1.1.0.1,
any.semialign ==1.2.0.1,
semialign +semigroupoids,
any.semigroupoids ==5.3.7,
semigroupoids +comonad +containers +contravariant +distributive +tagged +unordered-containers,
any.semigroups ==0.19.2,
any.semigroups ==0.20,
semigroups +binary +bytestring -bytestring-builder +containers +deepseq +hashable +tagged +template-haskell +text +transformers +unordered-containers,
any.serialise ==0.2.5.0,
serialise +newtime15,
Expand All @@ -174,7 +174,7 @@ constraints: any.Cabal ==3.2.1.0,
any.split ==0.2.3.4,
any.splitmix ==0.1.0.4,
splitmix -optimised-mixer,
any.stm ==2.5.0.1,
any.stm ==2.5.0.2,
any.stm-chans ==3.0.0.6,
any.streaming-commons ==0.2.2.4,
streaming-commons -use-bytestring-builder,
Expand All @@ -186,21 +186,23 @@ constraints: any.Cabal ==3.2.1.0,
any.tagged ==0.8.6.1,
tagged +deepseq +transformers,
any.tagsoup ==0.14.8,
any.template-haskell ==2.16.0.0,
any.terminfo ==0.4.1.4,
any.text ==1.2.4.1,
any.template-haskell ==2.18.0.0,
any.terminfo ==0.4.1.5,
any.text ==1.2.5.0,
any.text-short ==0.1.5,
text-short -asserts,
any.tf-random ==0.5,
any.th-abstraction ==0.4.3.0,
any.th-compat ==0.1.3,
any.these ==1.1.1.1,
these +assoc,
any.time ==1.9.3,
any.time ==1.11.1.1,
any.time-compat ==1.9.6.1,
time-compat -old-locale,
any.transformers ==0.5.6.2,
any.transformers-base ==0.4.6,
transformers-base +orphaninstances,
any.transformers-compat ==0.6.6,
any.transformers-compat ==0.7.2,
transformers-compat -five +five-three -four +generic-deriving +mtl -three -two,
any.type-equality ==1,
any.typed-process ==0.2.10.1,
Expand All @@ -225,4 +227,4 @@ constraints: any.Cabal ==3.2.1.0,
zephyr -test-core-libs -test-with-stack,
any.zlib ==0.6.3.0,
zlib -bundled-c-zlib -non-blocking-ffi -pkg-config
index-state: hackage.haskell.org 2022-06-23T22:25:02Z
index-state: hackage.haskell.org 2022-07-19T00:35:07Z
11 changes: 7 additions & 4 deletions src/Language/PureScript/DCE/CoreFn.hs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{-# LANGUAGE NoImplicitPrelude #-}

-- |
-- Dead code elimination for `CoreFn`.
module Language.PureScript.DCE.CoreFn
( runDeadCodeElimination
, runBindDeadCodeElimination
) where

import Prelude.Compat hiding (mod)
import Prelude hiding (mod)
import Control.Arrow ((***))
import Control.Monad ( guard )
import Data.Graph ( graphFromEdges, reachable, Vertex )
Expand All @@ -32,7 +34,8 @@ import Language.PureScript.Names
Ident(Ident),
ModuleName,
ProperName(runProperName),
Qualified(..) )
Qualified(..),
QualifiedBy(..) )

type Key = Qualified Ident

Expand Down Expand Up @@ -109,7 +112,7 @@ runDeadCodeElimination entryPoints modules = uncurry runModuleDeadCodeEliminatio

moduleForeign' :: [Ident]
moduleForeign' = filter
((`S.member` reachableSet) . Qualified (Just moduleName))
((`S.member` reachableSet) . Qualified (ByModuleName moduleName))
moduleForeign
where
reachableSet = foldr'
Expand Down Expand Up @@ -331,7 +334,7 @@ runBindDeadCodeElimination = go
else isUsedInExpr i e
isUsedInExpr i (App _ l r) = isUsedInExpr i l || isUsedInExpr i r
isUsedInExpr i (Abs _ i' e) = i /= i' && isUsedInExpr i e
isUsedInExpr i (Var _ qi) = qi == Qualified Nothing i
isUsedInExpr i (Var _ qi@(Qualified by _)) = qi == Qualified by i
isUsedInExpr i (Case _ es alts)
= any (isUsedInExpr i) es || any (isUsedInCaseAlternative i) alts
isUsedInExpr i (Let _ bs e) =
Expand Down
5 changes: 3 additions & 2 deletions src/Language/PureScript/DCE/Errors.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{-# LANGUAGE NoImplicitPrelude #-}

-- |
-- Errors used in dead call elimination.
module Language.PureScript.DCE.Errors
Expand All @@ -16,8 +18,7 @@ module Language.PureScript.DCE.Errors
)
where

import Prelude.Compat

import Prelude hiding (mod)
import Data.Char (isLower, isUpper, isSpace)
import Data.List (dropWhileEnd, findIndex, intersperse)
import Data.Text (Text)
Expand Down
Loading