Skip to content

Commit

Permalink
Extract UtilLF module from daml-lf-conversion to its own library (#11263
Browse files Browse the repository at this point in the history
)

changelog_begin
changelog_end
  • Loading branch information
akrmn authored Oct 15, 2021
1 parent 38712c0 commit e4808f6
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 12 deletions.
1 change: 1 addition & 0 deletions compiler/damlc/daml-compiler/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ da_haskell_library(
"//compiler/damlc/daml-ghc-util",
"//compiler/damlc/daml-ide-core",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-lf-util",
"//compiler/damlc/daml-opts",
"//compiler/damlc/daml-opts:daml-opts-types",
"//compiler/damlc/daml-package-config",
Expand Down
2 changes: 1 addition & 1 deletion compiler/damlc/daml-compiler/src/DA/Daml/Compiler/Repl.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import qualified DA.Daml.LF.TypeChecker as LF
import DA.Daml.LF.Ast.Optics (packageRefs)
import qualified DA.Daml.LF.ReplClient as ReplClient
import DA.Daml.LFConversion (convertModule)
import DA.Daml.LFConversion.UtilLF (buildPackage)
import DA.Daml.Options.Types
import qualified DA.Daml.Preprocessor.Records as Preprocessor
import DA.Daml.UtilGHC
import DA.Daml.UtilLF (buildPackage)
import Data.Bifunctor (first)
import Data.Functor.Alt
import Data.Functor.Bind
Expand Down
1 change: 1 addition & 0 deletions compiler/damlc/daml-ide-core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ da_haskell_library(
"//compiler/daml-lf-tools",
"//compiler/damlc/daml-doctest",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-lf-util",
"//compiler/damlc/daml-opts",
"//compiler/damlc/daml-opts:daml-opts-types",
"//compiler/damlc/daml-rule-types",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ import Development.IDE.Core.RuleTypes.Daml
import DA.Bazel.Runfiles
import DA.Daml.DocTest
import DA.Daml.LFConversion (convertModule)
import DA.Daml.LFConversion.UtilLF
import qualified DA.Daml.LF.Ast as LF
import qualified DA.Daml.LF.InferSerializability as Serializability
import qualified DA.Daml.LF.PrettyScenario as LF
import qualified DA.Daml.LF.Proto3.Archive as Archive
import qualified DA.Daml.LF.ScenarioServiceClient as SS
import qualified DA.Daml.LF.Simplifier as LF
import qualified DA.Daml.LF.TypeChecker as LF
import DA.Daml.UtilLF
import qualified DA.Pretty as Pretty
import SdkVersion (damlStdlib)

Expand Down
2 changes: 1 addition & 1 deletion compiler/damlc/daml-ide/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ da_haskell_library(
deps = [
"//compiler/daml-lf-ast",
"//compiler/damlc/daml-ide-core",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-lf-util",
"//compiler/damlc/daml-rule-types",
"//compiler/damlc/daml-visual",
"//libs-haskell/da-hs-base",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module DA.Daml.LanguageServer.CodeLens
) where

import Control.Monad.IO.Class
import DA.Daml.LFConversion.UtilLF (sourceLocToRange)
import qualified DA.Daml.LF.Ast as LF
import DA.Daml.UtilLF (sourceLocToRange)
import qualified Data.Aeson as Aeson
import Development.IDE.Core.Service.Daml
import Data.Foldable
Expand Down
1 change: 1 addition & 0 deletions compiler/damlc/daml-lf-conversion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ da_haskell_library(
"//compiler/daml-lf-proto",
"//compiler/daml-lf-tools",
"//compiler/damlc/daml-ghc-util",
"//compiler/damlc/daml-lf-util",
"//libs-haskell/da-hs-base",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ module DA.Daml.LFConversion
) where

import DA.Daml.LFConversion.Primitives
import DA.Daml.LFConversion.UtilLF
import DA.Daml.LFConversion.MetadataEncoding
import DA.Daml.UtilGHC
import DA.Daml.UtilLF

import Development.IDE.Types.Diagnostics
import Development.IDE.Types.Location
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-- | The DAML-LF primitives, matched with their type, and using 'primitive' on the libraries side.
module DA.Daml.LFConversion.Primitives(convertPrim) where

import DA.Daml.LFConversion.UtilLF
import DA.Daml.LF.Ast
import DA.Daml.UtilLF
import DA.Pretty (renderPretty)
import qualified Data.Text as T
import qualified Data.List as L
Expand Down
27 changes: 27 additions & 0 deletions compiler/damlc/daml-lf-util/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

load(
"//bazel_tools:haskell.bzl",
"da_haskell_library",
)

da_haskell_library(
name = "daml-lf-util",
srcs = glob(["src/**/*.hs"]),
hackage_deps = [
"base",
"bytestring",
"lsp-types",
"ghc-lib-parser",
"text",
],
repl_ghci_args = ["-hide-package=ghc"],
src_strip_prefix = "src",
visibility = ["//visibility:public"],
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//libs-haskell/da-hs-base",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

{-# OPTIONS_GHC -Wno-orphans #-}
-- | DAML-LF utility functions, may move to the LF utility if they are generally useful
module DA.Daml.LFConversion.UtilLF(
module DA.Daml.LFConversion.UtilLF
module DA.Daml.UtilLF (
module DA.Daml.UtilLF
) where

import DA.Daml.LF.Ast
Expand Down
2 changes: 1 addition & 1 deletion compiler/damlc/stable-packages/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ da_haskell_library(
deps = [
"//compiler/daml-lf-ast",
"//compiler/daml-lf-proto",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-lf-util",
"//libs-haskell/da-hs-base",
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import qualified Data.Text as T

import DA.Daml.LF.Ast
import DA.Daml.LF.Proto3.Archive
import DA.Daml.LFConversion.UtilLF
import DA.Daml.UtilLF

allStablePackages :: [Package]
allStablePackages =
Expand Down
2 changes: 1 addition & 1 deletion compiler/damlc/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ da_haskell_library(
"//compiler/daml-lf-proto",
"//compiler/damlc/daml-compiler",
"//compiler/damlc/daml-ide-core",
"//compiler/damlc/daml-lf-conversion",
"//compiler/damlc/daml-lf-util",
"//compiler/damlc/daml-opts",
"//compiler/damlc/daml-opts:daml-opts-types",
"//compiler/scenario-service/client",
Expand Down
2 changes: 1 addition & 1 deletion compiler/damlc/tests/src/DA/Test/DamlcIntegration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module DA.Test.DamlcIntegration
import DA.Bazel.Runfiles
import DA.Daml.Options
import DA.Daml.Options.Types
import DA.Daml.LFConversion.UtilLF
import DA.Daml.UtilLF
import DA.Test.Util (standardizeQuotes)

import DA.Daml.LF.Ast as LF hiding (IsTest)
Expand Down

0 comments on commit e4808f6

Please sign in to comment.