Skip to content

Commit

Permalink
Convert match (digital-asset#3795)
Browse files Browse the repository at this point in the history
* Update hlint

* Redefine base package to make more sense for daml

Also, elminate lens and attoparsesec packages and groups.

* Don't change the test; ignore the new lints

* More conversion haskell rules to daml
  • Loading branch information
Shayne Fletcher authored Dec 10, 2019
1 parent 6716947 commit ab7c579
Show file tree
Hide file tree
Showing 16 changed files with 271 additions and 428 deletions.
601 changes: 176 additions & 425 deletions compiler/damlc/daml-ide-core/dlint.yaml

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions compiler/damlc/tests/daml-test-files/DefaultMethods.daml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

-- Check that default implementations for type class methods can be translated
-- even in corner cases.

-- @INFO Use identity

daml 1.2
module DefaultMethods where

Expand Down
10 changes: 10 additions & 0 deletions compiler/damlc/tests/daml-test-files/List.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use null
-- @INFO Evaluate
-- @INFO Use sum
-- @INFO Use sum
-- @INFO Use sum
-- @INFO Use head
-- @INFO Use head
-- @INFO Use isNone
-- @INFO Use isNone

daml 1.2
module List where

Expand Down
3 changes: 3 additions & 0 deletions compiler/damlc/tests/daml-test-files/Math.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use sqrt
-- @INFO Use sqrt

daml 1.2
module Math where

Expand Down
2 changes: 2 additions & 0 deletions compiler/damlc/tests/daml-test-files/NoCaseOfCase.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use if

daml 1.2
module NoCaseOfCase where

Expand Down
7 changes: 7 additions & 0 deletions compiler/damlc/tests/daml-test-files/PartyCompare.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use >=
-- @INFO Use >=
-- @INFO Use >
-- @INFO Use <
-- @INFO Use <=
-- @INFO Use <=

daml 1.2
module PartyCompare where

Expand Down
2 changes: 2 additions & 0 deletions compiler/damlc/tests/daml-test-files/Phantom.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Replace case with optional

daml 1.2
module Phantom where

Expand Down
34 changes: 34 additions & 0 deletions compiler/damlc/tests/daml-test-files/PreludeTest.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use uncurry
-- @INFO Redundant identity
-- @INFO Redundant identity
-- @INFO Redundant identity
-- @INFO Evaluate
-- @INFO Use elem
-- @INFO Use elem
-- @INFO Use elem
-- @INFO Redundant if
-- @INFO Redundant if
-- @INFO Use ||
-- @INFO Use ||
-- @INFO Use ||
-- @INFO Use &&
-- @INFO Use &&
-- @INFO Use &&
-- @INFO Use isNone
-- @INFO Use $>
-- @INFO Evaluate
-- @INFO Evaluate
-- @INFO Use ++
-- @INFO Redundant flip
-- @INFO Redundant flip
-- @INFO Evaluate
-- @INFO Take on a non-positive
-- @INFO Drop on a non-positive
-- @INFO Use zip
-- @INFO Use zip
-- @INFO Use zip3
-- @INFO Use zip3
-- @INFO Evaluate
-- @INFO Evaluate
-- @INFO Evaluate

daml 1.2
module PreludeTest where

Expand Down
3 changes: 3 additions & 0 deletions compiler/damlc/tests/daml-test-files/RecordUpdate.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Evaluate
-- @INFO Use const

daml 1.2

module RecordUpdate where
Expand Down
5 changes: 5 additions & 0 deletions compiler/damlc/tests/daml-test-files/Set.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use infix
-- @INFO Use infix
-- @INFO Use infix
-- @INFO Use infix

-- @SINCE-LF 1.3
daml 1.2
module Set where
Expand Down
5 changes: 5 additions & 0 deletions compiler/damlc/tests/daml-test-files/ShortCircuit.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Redundant ==
-- @INFO Evaluate
-- @INFO Redundant ==
-- @INFO Evaluate

daml 1.2
module ShortCircuit where

Expand Down
8 changes: 8 additions & 0 deletions compiler/damlc/tests/daml-test-files/Text.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Evaluate
-- @INFO Evaluate
-- @INFO Use null
-- @INFO Use null
-- @INFO Use null
-- @INFO Use isNone
-- @INFO Use isNone

daml 1.2
module Text where

Expand Down
5 changes: 5 additions & 0 deletions compiler/damlc/tests/daml-test-files/TextMap.daml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
-- All rights reserved.
-- @SINCE-LF 1.3

-- @INFO Use /=
-- @INFO Use /=
-- @INFO Use /=
-- @INFO Use /=

daml 1.2
module TextMap where

Expand Down
2 changes: 2 additions & 0 deletions compiler/damlc/tests/daml-test-files/Trace.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use <$>

daml 1.2
module Trace where

Expand Down
3 changes: 3 additions & 0 deletions compiler/damlc/tests/daml-test-files/UseInteger.daml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
-- Copyright (c) 2019, Digital Asset (Switzerland) GmbH and/or its affiliates.
-- All rights reserved.

-- @INFO Use negate
-- @INFO Use negate

-- Test that foo does not overflow
-- @ QUERY-LF .modules[] | .values[] | select(.name_with_type | lf::get_value_name($pkg) == ["foo"]) | .expr.prim_lit | lf::get_int64($pkg) == "1"

Expand Down
6 changes: 3 additions & 3 deletions stack-snapshot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ packages:
- archive: http://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-8.8.1.20191204.tar.gz
sha256: "9648145ef7b3566fad7073ef63d0ef85056abe2c70c98f753306b70cbe9e0b5a"
- github: digital-asset/hlint
commit: "951fdb6d28d7eed8ea1c7f3be69da29b61fcbe8f"
sha256: "f5fb4cf98cde3ecf1209857208369a63ba21b04313d570c41dffe9f9139a1d34"
size: 167936
commit: "2eb1c457c28f0dae87ca9987f1a45e2b0ced6aae"
sha256: "8bee05e6cc465554a34eb52bb8ee39e15c584a9c24be6e9032dba0a93a99f262"
size: 176375
- bytestring-nums-0.3.6
- extra-1.6.18
- grpc-haskell-0.0.1.0
Expand Down

0 comments on commit ab7c579

Please sign in to comment.