From 9cad5f8478f4fa3adf30e8858efafa405ae288aa Mon Sep 17 00:00:00 2001 From: AttilaMihaly Date: Mon, 23 Dec 2024 10:13:59 +0100 Subject: [PATCH] Added Instant module (originally implemented by Stephen Torku) --- src/Morphir/IR/SDK.elm | 2 ++ src/Morphir/IR/SDK/Instant.elm | 49 ++++++++++++++++++++++++++++++++++ src/Morphir/SDK/Instant.elm | 27 +++++++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 src/Morphir/IR/SDK/Instant.elm create mode 100644 src/Morphir/SDK/Instant.elm diff --git a/src/Morphir/IR/SDK.elm b/src/Morphir/IR/SDK.elm index 2532c0c8f..b30059944 100644 --- a/src/Morphir/IR/SDK.elm +++ b/src/Morphir/IR/SDK.elm @@ -27,6 +27,7 @@ import Morphir.IR.SDK.Basics as Basics import Morphir.IR.SDK.Char as Char import Morphir.IR.SDK.Decimal as Decimal import Morphir.IR.SDK.Dict as Dict +import Morphir.IR.SDK.Instant as Instant import Morphir.IR.SDK.Int as Int import Morphir.IR.SDK.Key as Key import Morphir.IR.SDK.List as List @@ -76,6 +77,7 @@ packageSpec = , ( [ [ "number" ] ], Number.moduleSpec ) , ( [ [ "key" ] ], Key.moduleSpec ) , ( [ [ "aggregate" ] ], Aggregate.moduleSpec ) + , ( [ [ "instant" ] ], Instant.moduleSpec ) , ( [ [ "u", "u", "i", "d" ] ], UUID.moduleSpec ) ] } diff --git a/src/Morphir/IR/SDK/Instant.elm b/src/Morphir/IR/SDK/Instant.elm new file mode 100644 index 000000000..ea79262c4 --- /dev/null +++ b/src/Morphir/IR/SDK/Instant.elm @@ -0,0 +1,49 @@ +{- + Copyright 2020 Morgan Stanley + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +-} + + +module Morphir.IR.SDK.Instant exposing (..) + +import Dict +import Morphir.IR.Documented exposing (Documented) +import Morphir.IR.Module as Module exposing (ModuleName) +import Morphir.IR.Name as Name +import Morphir.IR.Path as Path exposing (Path) +import Morphir.IR.SDK.Common exposing (toFQName) +import Morphir.IR.Type exposing (Specification(..), Type(..)) + + +moduleName : ModuleName +moduleName = + Path.fromString "Instant" + + +moduleSpec : Module.Specification () +moduleSpec = + { types = + Dict.fromList + [ ( Name.fromString "Instant" + , OpaqueTypeSpecification [] + |> Documented "Type that represents a specific instantaneous point on the timeline." + ) + ] + , values = + Dict.fromList + [] + , doc = Just "Contains the Instant type (representing a specific instantaneous point in time), and it's associated functions." + } + + +instantType : a -> Type a +instantType attributes = + Reference attributes (toFQName moduleName "Instant") [] diff --git a/src/Morphir/SDK/Instant.elm b/src/Morphir/SDK/Instant.elm new file mode 100644 index 000000000..a35dc368e --- /dev/null +++ b/src/Morphir/SDK/Instant.elm @@ -0,0 +1,27 @@ +{- + Copyright 2020 Morgan Stanley + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +-} + + +module Morphir.SDK.Instant exposing (..) + +{-| This module adds the definition of an instantaneous point in time. + +@docs Instant + +-} + +import Time exposing (Posix) + + +type alias Instant = + Posix