Skip to content

Commit

Permalink
Drop DA.Next.Set and DA.Next.Map (#11864)
Browse files Browse the repository at this point in the history
* Drop DA.Next.Set and DA.Next.Map

Fixes #11527. Also removed a bunch of unnecessary CPP, though there's
still a lot more CPP to remove.

changelog_begin

- [Daml Standard Library] DA.Next.Map and DA.Next.Set have been removed
  after being deprecated since Daml-LF 1.11

changelog_end

* Drop a deriving MapKey

* update unstable-types test
  • Loading branch information
sofiafaro-da committed Nov 25, 2021
1 parent 5f3a4d2 commit 2f8f69e
Show file tree
Hide file tree
Showing 23 changed files with 17 additions and 637 deletions.
10 changes: 2 additions & 8 deletions compiler/damlc/daml-stdlib-src/DA/Internal/LF.daml
Expand Up @@ -21,9 +21,7 @@ module DA.Internal.LF

, TextMap

#ifdef DAML_GENMAP
, Map
#endif

, Update

Expand Down Expand Up @@ -125,26 +123,24 @@ instance Ord Time where (<=) = primitive @"BELessEq"
data TextMap a =
TextMap Opaque

#ifdef DAML_GENMAP
-- | The `Map a b` type represents an associative array from keys of type `a`
-- to values of type `b`. It uses the built-in equality for keys. Import
-- `DA.Map` to use it.
data Map a b =
Map Opaque
#endif

-- | The `ContractId a` type represents an ID for a contract created from a template `a`.
-- You can use the ID to fetch the contract, among other things.
data ContractId a =
ContractId Opaque
instance Eq (ContractId a) where (==) = primitive @"BEEqualContractId"
#ifdef DAML_GENERIC_COMPARISON

instance Ord (ContractId a) where
(<) = primitive @"BELess"
(<=) = primitive @"BELessEq"
(>) = primitive @"BEGreater"
(>=) = primitive @"BEGreaterEq"
#endif

instance Show (ContractId a) where
#ifdef DAML_CONTRACT_ID_TO_TEXT
show cid = case primitive @"BEContractIdToText" cid of
Expand Down Expand Up @@ -267,13 +263,11 @@ data TypeRep = TypeRep Opaque
instance Eq TypeRep where
(==) = primitive @"BEEqual"

#ifdef DAML_GENERIC_COMPARISON
instance Ord TypeRep where
(<=) = primitive @"BELessEq"
(>=) = primitive @"BEGreaterEq"
(<) = primitive @"BELess"
(>) = primitive @"BEGreater"
#endif -- DAML_GENERIC_COMPARISON
#endif

#ifdef DAML_EXCEPTIONS
Expand Down
20 changes: 0 additions & 20 deletions compiler/damlc/daml-stdlib-src/DA/Internal/Template/Functions.daml
Expand Up @@ -2,7 +2,6 @@
-- SPDX-License-Identifier: Apache-2.0

{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}

Expand All @@ -13,16 +12,12 @@
-- | MOVE Prelude Daml-LF primitives, just templates/contracts
module DA.Internal.Template.Functions where

#ifdef DAML_ANY_TYPE
import DA.Internal.Any
#endif
import DA.Internal.LF
import DA.Internal.Prelude
import DA.Internal.Template

#ifdef DAML_GENMAP && DAML_ANY_TYPE
import GHC.Types (primitive)
#endif

type TemplateOrInterface t =
( HasTemplateTypeRep t
Expand Down Expand Up @@ -227,28 +222,19 @@ instance IsParties (Optional Party) where
toParties None = []
toParties (Some p) = [p]

#ifdef DAML_GENERIC_COMPARISON && DAML_ANY_TYPE

instance Eq AnyTemplate where
(==) = primitive @"BEEqual"

instance Eq AnyChoice where
(==) = primitive @"BEEqual"

instance Eq AnyContractKey where
(==) = primitive @"BEEqual"

instance Ord AnyTemplate where
(<=) = primitive @"BELessEq"

instance Ord AnyChoice where
(<=) = primitive @"BELessEq"

instance Ord AnyContractKey where
(<=) = primitive @"BELessEq"
#endif

#ifdef DAML_TYPE_REP

-- | Generate a unique textual representation of the template id.
templateTypeRep : forall t. HasTemplateTypeRep t => TemplateTypeRep
Expand All @@ -257,11 +243,7 @@ templateTypeRep = TemplateTypeRep (_templateTypeRep ([] : [t]))
instance Eq TemplateTypeRep where
TemplateTypeRep a == TemplateTypeRep b = a == b

#ifdef DAML_GENERIC_COMPARISON
deriving instance Ord TemplateTypeRep
#endif

#ifdef DAML_ANY_TYPE

-- | Wrap the template in `AnyTemplate`.
--
Expand Down Expand Up @@ -325,8 +307,6 @@ fromAnyContractKey (AnyContractKey any rep)
| Some k <- _fromAnyContractKey ([] : [t]) any
, templateTypeRep @t == rep = Some k
| otherwise = None
#endif
#endif

deriving instance Eq Archive
deriving instance Show Archive
Expand Down
6 changes: 0 additions & 6 deletions compiler/damlc/daml-stdlib-src/DA/List/BuiltinOrder.daml
@@ -1,10 +1,5 @@
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
{-# LANGUAGE CPP #-}

#ifndef DAML_GENMAP
module DA.List.BuiltinOrder where
#else

-- | Note: This is only supported in DAML-LF 1.11 or later.
--
Expand Down Expand Up @@ -151,4 +146,3 @@ goUniqueOn f m (x :: xs) =
in case Map.lookup (f x) m of
None -> goUniqueOn f (Map.insert k () m) xs
Some _ -> False
#endif
13 changes: 0 additions & 13 deletions compiler/damlc/daml-stdlib-src/DA/Map.daml
@@ -1,17 +1,6 @@
-- Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0

{-# LANGUAGE CPP #-}


#ifndef DAML_GENMAP

-- | HIDE
module DA.Map where

#else


-- | Note: This is only supported in DAML-LF 1.11 or later.
--
-- This module exports the generic map type `Map k v` and associated
Expand Down Expand Up @@ -240,5 +229,3 @@ instance Ord k => Foldable.Foldable (Map k) where

instance Ord k => Traversable.Traversable (Map k) where
mapA f x = fmap fromList $ mapA (\(k, v) -> fmap (k,) $ f v) $ toList x

#endif
196 changes: 0 additions & 196 deletions compiler/damlc/daml-stdlib-src/DA/Next/Map.daml

This file was deleted.

0 comments on commit 2f8f69e

Please sign in to comment.