Skip to content
This repository was archived by the owner on Mar 2, 2025. It is now read-only.

Commit a884b58

Browse files
triallaxsharkdp
authored andcommitted
Update dependencies and fix some compiler warnings
Rationale for not upgrading some packages: - clipboardy 3.x.x needs to be imported with ESM imports - ditto for xdg-basedir 5.x.x - I have no idea if latest decimal.js works with `purescript-decimals` or not
1 parent d30194e commit a884b58

File tree

8 files changed

+8240
-2040
lines changed

8 files changed

+8240
-2040
lines changed

package-lock.json

Lines changed: 8208 additions & 1997 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@
3434
"url": "https://github.com/sharkdp/insect/issues"
3535
},
3636
"dependencies": {
37+
"clipboardy": "^2.3.0",
3738
"decimal.js": "^7.1.1",
3839
"historic-readline": "^1.0.8",
3940
"jquery.terminal": "^2.18.0",
4041
"keyboardevent-key-polyfill": "=1.1.0",
4142
"line-reader": "^0.4.0",
42-
"xdg-basedir": "^2.0.0",
43-
"clipboardy": "^2.3.0"
43+
"xdg-basedir": "^4.0.0"
4444
},
4545
"devDependencies": {
46-
"fs-extra": "^9.0.1",
46+
"fs-extra": "^10.0.1",
4747
"live-server": "^1.2.1",
4848
"npm-run-all": "^4.1.5",
4949
"psc-package": "^4.0.1",
50-
"pulp": "^15.0.0",
51-
"purescript": "^0.13.8"
50+
"pulp": "^16.0.0-0",
51+
"purescript": "^0.14.7"
5252
}
5353
}

psc-package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
"name": "insect",
3-
"set": "psc-0.13.6-20200123",
3+
"set": "psc-0.14.7-20220321",
44
"source": "https://github.com/purescript/package-sets.git",
55
"depends": [
66
"quantities",
77
"parsing",
88
"ordered-collections",
9-
"generics-rep",
109
"psci-support",
1110
"test-unit"
1211
]

src/Insect/Interpreter.purs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,20 @@ import Data.Foldable (foldMap, intercalate, foldl)
1414
import Data.Int (round, toNumber)
1515
import Data.List (List(..), sortBy, filter, groupBy, (..))
1616
import Data.List.NonEmpty (NonEmptyList(..), head, length, zip)
17-
import Data.Maybe (Maybe(..))
18-
import Data.NonEmpty (NonEmpty, (:|), foldl1)
1917
import Data.Map (lookup, insert, delete, toUnfoldable)
18+
import Data.Maybe (Maybe(..))
19+
import Data.NonEmpty (NonEmpty, (:|))
20+
import Data.Semigroup.Foldable (foldl1)
2021
import Data.String (toLower)
2122
import Data.Traversable (traverse)
2223
import Data.Tuple (Tuple(..), fst, snd)
23-
24-
import Quantities (Quantity, ConversionError(..))
25-
import Quantities as Q
26-
27-
import Insect.Language (BinOp(..), Expression(..), Command(..), Identifier,
28-
Statement(..), EvalError(..))
29-
import Insect.Environment (Environment, StorageType(..), StoredValue(..),
30-
FunctionDescription(..), StoredFunction(..),
31-
initialEnvironment, MathFunction)
24+
import Insect.Environment (Environment, StorageType(..), StoredValue(..), FunctionDescription(..), StoredFunction(..), initialEnvironment, MathFunction)
3225
import Insect.Format (FormattedString, Markup)
3326
import Insect.Format as F
27+
import Insect.Language (BinOp(..), Expression(..), Command(..), Identifier, Statement(..), EvalError(..))
3428
import Insect.PrettyPrint (pretty, prettyQuantity)
29+
import Quantities (Quantity, ConversionError(..))
30+
import Quantities as Q
3531

3632
-- | A type synonym for error handling. A value of type `Expect Number` is
3733
-- | expected to be a number but might also result in an evaluation error.
@@ -100,8 +96,8 @@ evalSpecial func _ _ _ _ _ = Left (InvalidIdentifier func)
10096

10197
-- | Evaluate Either.. mathematical expression involving physical quantities.
10298
eval Environment Expression Expect Quantity
103-
eval env (Scalar n) = pure $ Q.scalar' n
104-
eval env (Unit u) = pure $ Q.quantity 1.0 u
99+
eval _ (Scalar n) = pure $ Q.scalar' n
100+
eval _ (Unit u) = pure $ Q.quantity 1.0 u
105101
eval env (Variable name) = case lookup name env.values of
106102
Just (StoredValue _ q) → pure q
107103
NothingLeft (LookupError name)
@@ -316,7 +312,7 @@ runInsect env (PrettyPrintFunction name) =
316312
where
317313
message =
318314
case lookup name env.functions of
319-
Just (StoredFunction _ fn (BuiltinFunction args)) →
315+
Just (StoredFunction _ _ (BuiltinFunction args)) →
320316
Message Info [ F.optional (F.text " "),
321317
F.ident name,
322318
F.text "(",
@@ -328,7 +324,7 @@ runInsect env (PrettyPrintFunction name) =
328324
Just 2 -> "x, y"
329325
Just _ -> "x, y, …"
330326
Nothing -> "x1, x2, …"
331-
Just (StoredFunction _ fn (UserFunction args expr)) →
327+
Just (StoredFunction _ _ (UserFunction args expr)) →
332328
Message Info $ (F.optional <$> (F.text " " : (prettyPrintFunction name args))) <> pretty expr
333329
NothingMessage Error [ F.text "Unknown function" ]
334330

@@ -372,11 +368,11 @@ runInsect env (Command List) =
372368
(singleton <<< F.ident <<< fst) <$> kvPairs
373369
val = storedValue (snd (head kvPairs))
374370

375-
runInsect env (Command Reset) =
371+
runInsect _ (Command Reset) =
376372
{ msg: Message Info [F.text "Environment has been reset."]
377373
, newEnv: initialEnvironment }
378374

379-
runInsect env (Command Quit) = { msg: MQuit, newEnv: initialEnvironment }
375+
runInsect _ (Command Quit) = { msg: MQuit, newEnv: initialEnvironment }
380376

381377
runInsect env (Command Copy) = { msg: MCopy, newEnv: env }
382378

src/Insect/Language.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Prelude hiding (Unit)
1212

1313
import Data.Decimal (Decimal)
1414
import Data.Generic.Rep (class Generic)
15-
import Data.Generic.Rep.Show (genericShow)
15+
import Data.Show.Generic (genericShow)
1616
import Data.List (List)
1717
import Data.NonEmpty (NonEmpty)
1818
import Data.Units (DerivedUnit)

src/Insect/Parser.purs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,25 @@ import Prelude hiding (degree)
1414

1515
import Control.Alt ((<|>))
1616
import Control.Lazy (fix)
17-
18-
import Quantities (DerivedUnit, (./))
19-
import Quantities as Q
20-
2117
import Data.Array (some, fromFoldable)
2218
import Data.Decimal (Decimal, fromString, fromNumber, isFinite)
2319
import Data.Either (Either, isRight)
2420
import Data.Foldable (foldr, traverse_)
2521
import Data.Foldable as F
2622
import Data.List (List, many, init, last)
27-
import Data.Maybe (Maybe(..), fromMaybe)
28-
import Data.NonEmpty (NonEmpty, (:|), foldl1)
2923
import Data.Map (lookup)
24+
import Data.Maybe (Maybe(..), fromMaybe)
25+
import Data.NonEmpty (NonEmpty, (:|))
26+
import Data.Semigroup.Foldable (foldl1)
3027
import Data.String (fromCodePointArray, codePointFromChar, singleton)
31-
28+
import Insect.Environment (Environment, StoredFunction(..))
29+
import Insect.Language (BinOp(..), Expression(..), Command(..), Statement(..), Identifier)
30+
import Quantities (DerivedUnit, (./))
31+
import Quantities as Q
3232
import Text.Parsing.Parser (ParserT, Parser, ParseError, runParser, fail)
33-
import Text.Parsing.Parser.Combinators (option, optionMaybe, try, (<?>),
34-
notFollowedBy)
33+
import Text.Parsing.Parser.Combinators (option, optionMaybe, try, (<?>), notFollowedBy)
3534
import Text.Parsing.Parser.String (string, char, eof, oneOf)
36-
import Text.Parsing.Parser.Token (GenLanguageDef(..), LanguageDef, TokenParser,
37-
digit, letter, makeTokenParser)
38-
39-
import Insect.Language (BinOp(..), Expression(..), Command(..), Statement(..),
40-
Identifier)
41-
import Insect.Environment (Environment, StoredFunction(..))
35+
import Text.Parsing.Parser.Token (GenLanguageDef(..), LanguageDef, TokenParser, digit, letter, makeTokenParser)
4236

4337
-- | A type synonym for the main Parser type with `String` as input.
4438
type P a = Parser String a
@@ -351,7 +345,7 @@ function env = do
351345
pure name
352346
else
353347
case lookup name env.functions of
354-
Just (StoredFunction _ fn _) → pure name
348+
Just (StoredFunction _ _ _) → pure name
355349
Nothing → fail ("Unknown function '" <> name <> "'")
356350

357351
-- | Parse a full mathematical expression.

src/Insect/PrettyPrint.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ withParens' x = parens (pretty x)
7575
-- | Add parenthesis, if needed - liberal version, can not be used for
7676
-- | Exponentiation.
7777
withParens Expression Markup
78-
withParens e@(BinOp Mul (Scalar s) (Unit u)) = pretty e
78+
withParens e@(BinOp Mul (Scalar _) (Unit _)) = pretty e
7979
withParens e = withParens' e
8080

8181
-- | Pretty print an Insect expression.

test/Main.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ shouldFail ∷ String → Aff Unit
5656
shouldFail input = do
5757
case parseInsect initialEnvironment input of
5858
Left _ → pure unit
59-
Right output → failure $ "input is expected to throw a parse error: '" <> input <> "'"
59+
Right _ → failure $ "input is expected to throw a parse error: '" <> input <> "'"
6060

6161
expectOutput Environment String String Aff Unit
6262
expectOutput env expected inp =

0 commit comments

Comments
 (0)