├── .nvmrc ├── .mill-version ├── .morphir-version ├── .github ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── dependabot.yml ├── scripts │ ├── wrap-gpg.sh │ └── gpg-setup.sh ├── renovate.json ├── ISSUE_TEMPLATE │ ├── Support_question.md │ ├── Feature_request.md │ └── Bug_report.md ├── workflows │ ├── release-drafter.yml │ ├── auto-approve.yml │ ├── github-dependency-review.yml │ └── github-dependency-graph.yml └── release-drafter.yml ├── .mill-cs.opts ├── morphir ├── src │ ├── org │ │ └── finos │ │ │ └── morphir │ │ │ ├── runtime │ │ │ ├── internal │ │ │ │ ├── Succinct.scala │ │ │ │ ├── StoredValue.scala │ │ │ │ └── CallStackFrame.scala │ │ │ ├── services │ │ │ │ ├── kernel │ │ │ │ │ ├── package.scala │ │ │ │ │ └── Kernel.scala │ │ │ │ └── sdk │ │ │ │ │ └── MorphirSdk.scala │ │ │ ├── RuntimeTypeExports.scala │ │ │ ├── environment.scala │ │ │ └── sdk │ │ │ │ ├── README.md │ │ │ │ └── KeySDK.scala │ │ │ ├── universe │ │ │ ├── ir │ │ │ │ ├── TypeTransformer.scala │ │ │ │ ├── HasFQNameInfo.scala │ │ │ │ ├── PackageDefinition.scala │ │ │ │ ├── TypeConstructor.scala │ │ │ │ ├── PackageSpecification.scala │ │ │ │ ├── TypeConstructorArg.scala │ │ │ │ ├── FQNameInfo.scala │ │ │ │ ├── TypeConstructorArgs.scala │ │ │ │ ├── TypeConstructors.scala │ │ │ │ ├── TypeMapReferenceName.scala │ │ │ │ ├── Documented.scala │ │ │ │ ├── TypeDefinition.scala │ │ │ │ └── TypeInfo.scala │ │ │ ├── errors.scala │ │ │ ├── HasConceptId.scala │ │ │ ├── MorphirNumber.scala │ │ │ ├── ConceptId.scala │ │ │ ├── MorphirTypeTag.scala │ │ │ └── MorphirExpr.scala │ │ │ ├── dsl.scala │ │ │ ├── utils.scala │ │ │ ├── ir │ │ │ ├── module │ │ │ │ ├── package.scala │ │ │ │ └── ModuleSpecFor.scala │ │ │ ├── ParserError.scala │ │ │ ├── source │ │ │ │ ├── Located.scala │ │ │ │ ├── Region.scala │ │ │ │ └── Location.scala │ │ │ ├── Module.scala │ │ │ ├── dsl │ │ │ │ ├── attributed.scala │ │ │ │ └── utype.scala │ │ │ ├── PackageModule.scala │ │ │ ├── Attributed.scala │ │ │ ├── Distribution.scala │ │ │ ├── MorphirIRFile.scala │ │ │ ├── InferredTypeOf.scala │ │ │ ├── packages │ │ │ │ ├── package.scala │ │ │ │ └── PackageModule.scala │ │ │ ├── Source.scala │ │ │ ├── distribution │ │ │ │ └── DistributionModule.scala │ │ │ ├── Named.scala │ │ │ └── MorphirIRVersion.scala │ │ │ ├── util │ │ │ ├── UnreachableException.scala │ │ │ ├── UnsupportedException.scala │ │ │ ├── package.scala │ │ │ └── attribs │ │ │ │ └── AttributeValueChangingInterceptor.scala │ │ │ ├── codec │ │ │ ├── Decoder.scala │ │ │ ├── Codec.scala │ │ │ ├── Encoder.scala │ │ │ ├── NOTICE.md │ │ │ ├── BinaryCodec.scala │ │ │ └── DecodeError.scala │ │ │ ├── internal │ │ │ ├── syntax │ │ │ │ └── TypeCreationSyntax.scala │ │ │ └── all.scala │ │ │ ├── syntax │ │ │ ├── AllSyntax.scala │ │ │ └── NamingSyntax.scala │ │ │ ├── functional │ │ │ ├── package.scala │ │ │ └── TypeTagging.scala │ │ │ ├── mir.scala │ │ │ ├── datamodel │ │ │ ├── UnionType.scala │ │ │ ├── Attributes.scala │ │ │ ├── Label.scala │ │ │ ├── ConceptId.scala │ │ │ ├── Schema.scala │ │ │ ├── DataEncoder.scala │ │ │ ├── CustomDeriver.scala │ │ │ ├── SingleEnumWrapper.scala │ │ │ └── BasicDataType.scala │ │ │ ├── lang │ │ │ └── elm │ │ │ │ ├── semver │ │ │ │ ├── Constraint.scala │ │ │ │ ├── Range.scala │ │ │ │ ├── Interval.scala │ │ │ │ ├── Relation.scala │ │ │ │ └── Strictness.scala │ │ │ │ └── ElmProject.scala │ │ │ ├── codecs │ │ │ └── package.scala │ │ │ ├── core │ │ │ └── capabilities │ │ │ │ ├── package.scala │ │ │ │ └── Show.scala │ │ │ ├── Hints.scala │ │ │ ├── Names.scala │ │ │ ├── NamingOptionsModule.scala │ │ │ ├── model │ │ │ └── MorphirProject.scala │ │ │ ├── MorphirTag.scala │ │ │ ├── extensibility │ │ │ └── MorphirModule.scala │ │ │ └── ModuleDescriptor.scala │ └── morphir │ │ └── ir │ │ ├── Decoration.scala │ │ └── Name.scala ├── tools │ ├── src │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── util │ │ │ └── vfile │ │ │ │ ├── VMessage.scala │ │ │ │ └── VFileProperties.scala │ │ │ ├── config │ │ │ ├── lang │ │ │ │ └── elm │ │ │ │ │ └── ElmConfig.scala │ │ │ └── WorkspaceConfig.scala │ │ │ └── service │ │ │ ├── ProcessIO.scala │ │ │ ├── FileIO.scala │ │ │ └── MorphirSetup.scala │ ├── js │ │ └── src │ │ │ ├── org │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ ├── util │ │ │ │ └── vfile │ │ │ │ │ ├── VFilePlatformSpecific.scala │ │ │ │ │ └── VPathCompanionApi.scala │ │ │ │ └── service │ │ │ │ └── ProcessIOPlatformSpecific.scala │ │ │ └── fs2 │ │ │ └── io │ │ │ └── platform │ │ │ └── js │ │ │ └── PathHelper.scala │ ├── jvm-native │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── util │ │ │ └── vfile │ │ │ ├── VFilePlatformSpecific.scala │ │ │ └── VPathCompanionApi.scala │ ├── cli │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── cli │ │ │ ├── cmdlet │ │ │ │ ├── Cmdlet.scala │ │ │ │ ├── SetupCmdlet.scala │ │ │ │ ├── InitCmdlet.scala │ │ │ │ ├── AboutCmdlet.scala │ │ │ │ ├── WorkspaceCmdlet.scala │ │ │ │ ├── ElmCmdlet.scala │ │ │ │ ├── ElmGenCmdlet.scala │ │ │ │ ├── ElmMakeCmdlet.scala │ │ │ │ └── ElmDevelopCmdlet.scala │ │ │ └── CliCommandRouter.scala │ │ │ └── Main.scala │ ├── launcher │ │ ├── test │ │ │ └── src │ │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ └── launcher │ │ │ │ ├── MorphirVersionTest.scala │ │ │ │ ├── CoursierTest.scala │ │ │ │ └── MainSpec.scala │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── launcher │ │ │ └── Coursier.scala │ ├── native │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── service │ │ │ ├── ProcessIOPlatformSpecific.scala │ │ │ └── FileIOPlatformSpecific.scala │ ├── jvm │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── service │ │ │ └── ProcessIOPlatformSpecific.scala │ └── js-jvm │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── service │ │ └── FileIOPlatformSpecific.scala ├── runtime │ ├── js │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── runtime │ │ │ ├── MorphirRuntimePlatformSpecific.scala │ │ │ ├── EvaluationLibraryPlatformSpecific.scala │ │ │ └── service │ │ │ └── MorphirRuntimeDriverPlatformSpecific.scala │ ├── jvm │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── runtime │ │ │ ├── MorphirRuntimePlatformSpecific.scala │ │ │ └── service │ │ │ └── MorphirRuntimeDriverPlatformSpecific.scala │ ├── native │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── runtime │ │ │ ├── MorphirRuntimePlatformSpecific.scala │ │ │ ├── EvaluationLibraryPlatformSpecific.scala │ │ │ └── service │ │ │ └── MorphirRuntimeDriverPlatformSpecific.scala │ ├── src │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── runtime │ │ │ ├── EvaluationLibrary.scala │ │ │ ├── extensions.scala │ │ │ ├── predef.scala │ │ │ ├── Resolver.scala │ │ │ ├── MorphirRuntimeSetup.scala │ │ │ ├── SingleTestResult.scala │ │ │ ├── RunConfiguration.scala │ │ │ ├── service │ │ │ └── MorphirRuntimeDriver.scala │ │ │ └── Runtime.scala │ └── test │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── runtime │ │ └── CallStackSpec.scala ├── testing │ ├── generators │ │ ├── src │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ └── ir │ │ │ │ └── generator │ │ │ │ ├── Gens.scala │ │ │ │ ├── ModuleNameGen.scala │ │ │ │ ├── PathGen.scala │ │ │ │ ├── PackageNameGen.scala │ │ │ │ ├── NameGen.scala │ │ │ │ ├── QNameGen.scala │ │ │ │ ├── FieldGen.scala │ │ │ │ ├── DocumentedGen.scala │ │ │ │ ├── FQNameGen.scala │ │ │ │ ├── QualifiedModuleNameGen.scala │ │ │ │ ├── MorphirIRFileGen.scala │ │ │ │ ├── AccessControlledGen.scala │ │ │ │ └── MorphirIRGen.scala │ │ └── js-jvm │ │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── ir │ │ │ └── generator │ │ │ ├── PathDeriveGen.scala │ │ │ ├── NameDeriveGen.scala │ │ │ ├── QNameDeriveGen.scala │ │ │ ├── FQNameDeriveGen.scala │ │ │ ├── PackageNameDeriveGen.scala │ │ │ ├── ModuleNameDeriveGen.scala │ │ │ ├── DocumentedDeriveGen.scala │ │ │ ├── FieldDeriveGen.scala │ │ │ ├── ConstructorsDeriveGen.scala │ │ │ ├── QualifiedModuleNameDeriveGen.scala │ │ │ ├── ValueSpecificationDeriveGen.scala │ │ │ ├── ModuleSpecificationDeriveGen.scala │ │ │ ├── ModuleDefinitionDeriveGen.scala │ │ │ ├── PackageSpecificationDeriveGen.scala │ │ │ ├── ValueDefinitionDeriveGen.scala │ │ │ ├── MorphirIRFileDeriveGen.scala │ │ │ ├── PackageDefinitionDeriveGen.scala │ │ │ ├── DistributionDeriveGen.scala │ │ │ ├── AccessControlledDeriveGen.scala │ │ │ └── TypeDefinitionDeriveGen.scala │ └── compiler │ │ └── interface │ │ └── src │ │ └── scala │ │ └── morphir │ │ └── api │ │ └── CompilationFailedException.java ├── contrib │ └── knowledge │ │ ├── src │ │ └── morphir │ │ │ └── kb │ │ │ └── logic │ │ │ ├── core │ │ │ ├── FieldConstraint.scala │ │ │ ├── package.scala │ │ │ └── Field.scala │ │ │ ├── microkanren.scala │ │ │ └── converter │ │ │ └── ConstraintConverter.scala │ │ └── test │ │ └── src │ │ └── morphir │ │ └── knowledge │ │ └── logic │ │ └── core │ │ └── FieldSpec.scala ├── src-3 │ └── org │ │ └── finos │ │ └── morphir │ │ ├── datamodel │ │ ├── DeriverTypes.scala │ │ └── EnumTranslation.scala │ │ ├── universe │ │ └── ir │ │ │ └── IsNotAType.scala │ │ ├── ir │ │ ├── internal │ │ │ ├── validators.scala │ │ │ └── types.scala │ │ └── IsNotAValue.scala │ │ ├── functional │ │ ├── IdNewtypeEncoding.scala │ │ ├── IsNotCovariant.scala │ │ └── Newtype.scala │ │ ├── DumperVersionSpecific.scala │ │ ├── =!=.scala │ │ └── Not.scala ├── lib │ ├── interop │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── runtime │ │ │ ├── UndefinedBehaviorError.scala │ │ │ └── package.scala │ │ │ ├── interop │ │ │ └── extern.scala │ │ │ └── Default.scala │ └── ReadMe.md ├── interop │ ├── zio │ │ └── json │ │ │ ├── src │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ └── ir │ │ │ │ └── json │ │ │ │ ├── MorphirJsonSupport.scala │ │ │ │ ├── MorphirJsonSupportV1.scala │ │ │ │ ├── MorphirJsonSupportV2.scala │ │ │ │ └── JsonEncodingHelpers.scala │ │ │ └── test │ │ │ └── src │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── datamodel │ │ │ └── json │ │ │ │ └── zio │ │ │ │ └── ZioJsonSuite.scala │ │ │ └── ir │ │ │ └── json │ │ │ └── codec │ │ │ ├── MorphirIRFileJsonCodecProviderSpec.scala │ │ │ ├── NameJsonCodecProviderSpec.scala │ │ │ ├── PathJsonCodecProviderSpec.scala │ │ │ ├── QNameJsonCodecProviderSpec.scala │ │ │ ├── FQNameJsonCodecProviderSpec.scala │ │ │ ├── LiteralJsonCodecProviderSpec.scala │ │ │ ├── ModuleNameJsonCodecProviderSpec.scala │ │ │ ├── PackageNameJsonCodecProviderSpec.scala │ │ │ ├── DocumentedJsonCodecProviderSpec.scala │ │ │ ├── DistributionJsonCodecProviderSpec.scala │ │ │ └── FieldJsonCodecProviderSpec.scala │ └── borer │ │ └── test │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── datamodel │ │ └── codecs │ │ └── Utils.scala ├── tests │ ├── test │ │ ├── js │ │ │ └── src │ │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ └── util │ │ │ │ └── vfile │ │ │ │ ├── VPathSpecPlatformSpecific.scala │ │ │ │ └── VFileSpecPlatformSpecific.scala │ │ ├── src │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ ├── ir │ │ │ │ ├── distribution │ │ │ │ │ └── DistributionSpec.scala │ │ │ │ ├── QualifiedModuleNameSpec.scala │ │ │ │ ├── sdk │ │ │ │ │ └── CommonSpec.scala │ │ │ │ ├── ModuleSpec.scala │ │ │ │ ├── FieldSpec.scala │ │ │ │ └── internal │ │ │ │ │ └── NonEmptyStringSpec.scala │ │ │ │ ├── util │ │ │ │ ├── vfile │ │ │ │ │ ├── VFileSpec.scala │ │ │ │ │ └── VPathSpec.scala │ │ │ │ ├── attribs │ │ │ │ │ └── AttributeSpec.scala │ │ │ │ └── ScopedVarSpec.scala │ │ │ │ ├── extensibility │ │ │ │ └── SdkModuleDescriptorsSpec.scala │ │ │ │ ├── samples │ │ │ │ └── AttributionExample.scala │ │ │ │ └── datamodel │ │ │ │ └── ToDataOptionalSpec.scala │ │ ├── jvm-native │ │ │ └── src │ │ │ │ └── org │ │ │ │ └── finos │ │ │ │ └── morphir │ │ │ │ └── util │ │ │ │ └── vfile │ │ │ │ ├── VFileSpecPlatformSpecific.scala │ │ │ │ └── VPathSpecPlatformSpecific.scala │ │ └── src-3 │ │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── util │ │ │ └── PrinterSpec.scala │ ├── src-3 │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── datamodel │ │ │ └── testModels.scala │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ ├── testing │ │ └── model │ │ │ └── models.scala │ │ └── universe │ │ └── ir │ │ └── KnownTypes.scala ├── meta │ ├── src-3 │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── deriving │ │ │ └── lazy_.scala │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── meta │ │ └── meta.scala ├── build │ └── integration │ │ └── mill │ │ └── morphir-elm │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── mill │ │ └── elm │ │ └── MorphirElmModule.scala ├── elm │ └── facade │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── elm │ │ └── facade │ │ └── CliFacade.scala ├── extensibility │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── annotation │ │ └── qualifiedModuleName.scala ├── toolkit │ └── codec │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── mir │ │ └── file │ │ └── format │ │ └── MirFile.scala ├── ReadMe.md └── main │ └── src │ └── org │ └── finos │ └── morphir │ └── cli │ └── MorphirCommand.scala ├── bun.lockb ├── .mill-jvm-opts ├── examples └── morphir-elm-projects │ ├── finance │ ├── .gitignore │ ├── moon.yml │ ├── bun.lockb │ ├── morphir.json │ ├── elm-tooling.json │ ├── package.json │ └── src │ │ └── elm │ │ └── Morphir │ │ └── Examples │ │ └── Accounting │ │ ├── Journal.elm │ │ └── TAccount.elm │ ├── defaults-tests │ ├── moon.yml │ ├── bun.lockb │ ├── ReadMe.md │ ├── morphir.json │ ├── elm-tooling.json │ ├── package.json │ └── elm.json │ ├── evaluator-tests │ ├── moon.yml │ ├── .gitignore │ ├── elm-tooling.json │ ├── src │ │ └── Morphir │ │ │ └── Examples │ │ │ └── App │ │ │ ├── EnumTest.elm │ │ │ ├── TestUtils.elm │ │ │ ├── SimpleTests.elm │ │ │ └── MyMap.elm │ └── package.json │ └── unit-test-framework │ ├── example-project │ ├── moon.yml │ ├── ReadMe.md │ ├── bun.lockb │ ├── morphir.json │ ├── elm-tooling.json │ ├── package.json │ ├── elm.json │ └── src │ │ └── Example │ │ └── ExampleModule.elm │ ├── example-project-tests │ ├── bun.lockb │ ├── ReadMe.md │ ├── elm-tooling.json │ ├── moon.yml │ ├── package.json │ └── morphir.json │ ├── example-project-tests-passing │ ├── ReadMe.md │ ├── bun.lockb │ ├── elm-tooling.json │ ├── morphir.json │ ├── moon.yml │ └── package.json │ └── example-project-tests-incomplete │ ├── ReadMe.md │ ├── bun.lockb │ ├── elm-tooling.json │ ├── moon.yml │ ├── morphir.json │ └── package.json ├── morphir-elm └── sdks │ └── morphir-unit-test │ ├── .gitignore │ ├── moon.yml │ ├── bun.lockb │ ├── morphir.json │ ├── elm-tooling.json │ └── package.json ├── .sbtopts ├── .gitpod.Dockerfile ├── archived ├── lang │ ├── src │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ └── lang │ │ │ ├── mir │ │ │ └── text │ │ │ │ └── package.scala │ │ │ └── scaladsl │ │ │ ├── package.scala │ │ │ └── Syntax.scala │ └── test │ │ └── src │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── samples │ │ ├── Hello.scala │ │ └── Basics.scala ├── core │ ├── src │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── core │ │ │ ├── errors.scala │ │ │ ├── types │ │ │ │ └── Versioning.scala │ │ │ └── Strings.scala │ │ │ ├── ir │ │ │ ├── IRReadWriters.scala │ │ │ ├── Transformer.scala │ │ │ ├── Readable.scala │ │ │ ├── Distribution.scala │ │ │ ├── Documented.scala │ │ │ └── visitors.scala │ │ │ └── printing │ │ │ ├── PPrint.scala │ │ │ └── Stringify.scala │ └── test │ │ ├── src │ │ └── org │ │ │ └── finos │ │ │ └── morphir │ │ │ ├── core │ │ │ ├── CoreModuleSpec.scala │ │ │ └── types │ │ │ │ └── EncodedStringSpec.scala │ │ │ └── example │ │ │ └── VisitorUsage.scala │ │ └── src-3 │ │ └── org │ │ └── finos │ │ └── morphir │ │ └── meta │ │ └── PrintMacroUsage.scala └── concepts │ └── src │ └── org │ └── finos │ └── morphir │ └── concepts │ ├── Distro.scala │ └── workspace │ └── Workspace.scala ├── .prototools ├── morphir-local ├── .gitattributes ├── mill-build ├── src │ ├── millbuild │ │ ├── crossplatform │ │ │ └── DevMode.scala │ │ ├── package.scala │ │ ├── MyBuild.scala │ │ └── settings │ │ │ ├── JvmBuildSettings.scala │ │ │ ├── MillSettings.scala │ │ │ ├── ScalaJsBuildSettings.scala │ │ │ └── ScalaNativeBuildSettings.scala │ ├── mill │ │ └── local │ │ │ └── plugins │ │ │ └── ci │ │ │ └── release │ │ │ ├── Discover.scala.scala │ │ │ ├── Eval.scala │ │ │ └── Env.scala │ └── org │ │ └── finos │ │ └── millmorphir │ │ ├── api │ │ ├── MakeInputs.scala │ │ ├── Named.scala │ │ ├── MorphirProjectConfig.scala │ │ ├── MakeResult.scala │ │ └── MakeOutputs.scala │ │ └── elm │ │ └── MorphirElmModule.scala └── build.sc ├── .editorconfig ├── morphir-cli-install.sh ├── .moon ├── tasks │ ├── tag-elm.yml │ └── tag-morphir-elm.yml ├── tasks.yml └── toolchain.yml ├── PROJECT.spdx ├── coursier-insiders-channel.json ├── NOTICE ├── package.json ├── moon.yml ├── .scalafix.conf ├── morphir-cli-local-install.sh ├── coursier-channel.json ├── ci └── release-maven.sh ├── .gitpod.yml ├── project └── modules │ └── crossplatform.sc └── .mergify.yml /.nvmrc: -------------------------------------------------------------------------------- 1 | lts/* -------------------------------------------------------------------------------- /.mill-version: -------------------------------------------------------------------------------- 1 | 0.11.12 2 | -------------------------------------------------------------------------------- /.morphir-version: -------------------------------------------------------------------------------- 1 | 0.2.1 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | @DamianReeves -------------------------------------------------------------------------------- /.mill-cs.opts: -------------------------------------------------------------------------------- 1 | --scala 2 | 2.13.8 -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/internal/Succinct.scala: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeTransformer.scala: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/bun.lockb -------------------------------------------------------------------------------- /.mill-jvm-opts: -------------------------------------------------------------------------------- 1 | -Xmx4g 2 | -Xms128m 3 | -Xss8m 4 | -Dxsbt.skip.cp.lookup=true 5 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/.gitignore: -------------------------------------------------------------------------------- 1 | morphir-ir.json 2 | morphir-hashes.json -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/.gitignore: -------------------------------------------------------------------------------- 1 | morphir-ir.json 2 | morphir-hashes.json -------------------------------------------------------------------------------- /morphir/src/morphir/ir/Decoration.scala: -------------------------------------------------------------------------------- 1 | package morphir.ir 2 | 3 | object Decoration {} 4 | -------------------------------------------------------------------------------- /.sbtopts: -------------------------------------------------------------------------------- 1 | -J-Xss512M 2 | 3 | -J-Xms5120m 4 | -J-Xmx5120m 5 | -J-XX:MaxMetaspaceSize=1024m 6 | -J-XX:MetaspaceSize=760m -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/dsl.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | object Dsl extends syntax.AllSyntax 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/utils.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | object utils extends DumperSyntax 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/module/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | package object module {} 4 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tags: 3 | - "morphir" 4 | - "morphir-elm" 5 | - "elm" 6 | -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tags: 3 | - "morphir" 4 | - "morphir-elm" 5 | - "elm" 6 | -------------------------------------------------------------------------------- /.gitpod.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM gitpod/workspace-full 2 | 3 | RUN brew install mill 4 | RUN brew install Virtuslab/scala-cli/scala-cli 5 | -------------------------------------------------------------------------------- /archived/lang/src/org/finos/morphir/lang/mir/text/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.mir 2 | 3 | package object text {} 4 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tags: 3 | - "morphir" 4 | - "morphir-elm" 5 | - "elm" 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tags: 3 | - "morphir" 4 | - "morphir-elm" 5 | - "elm" 6 | -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/morphir-elm/sdks/morphir-unit-test/bun.lockb -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/util/vfile/VMessage.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | final case class VMessage() 4 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/finance/bun.lockb -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/ParserError.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | final case class ParserError(msg: String) extends Exception 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/source/Located.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.source 2 | 3 | final case class Located[+A](at: Region, value: A) 4 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct for morphir4s 2 | 3 | Please see the [Community Code of Conduct](https://www.finos.org/code-of-conduct). 4 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/core/errors.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core 2 | 3 | final case class ParserError(msg: String) extends Exception 4 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tags: 3 | - "morphir" 4 | - "morphir-elm" 5 | - "elm" 6 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/util/UnreachableException.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util 2 | 3 | case object UnreachableException extends Exception 4 | -------------------------------------------------------------------------------- /morphir/tools/js/src/org/finos/morphir/util/vfile/VFilePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | trait VFilePlatformSpecific {} 4 | -------------------------------------------------------------------------------- /.prototools: -------------------------------------------------------------------------------- 1 | bun = "1.1.26" 2 | moon = "1.27.10" 3 | 4 | [plugins] 5 | moon = "source:https://raw.githubusercontent.com/moonrepo/moon/master/proto-plugin.toml" 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/defaults-tests/bun.lockb -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/Decoder.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.codec 2 | 3 | import zio.stream.ZPipeline 4 | trait Decoder[Whole, Element, +A] {} 5 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/internal/syntax/TypeCreationSyntax.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.internal.syntax 2 | 3 | trait TypeCreationSyntax { self => } 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/errors.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | final case class ParserError(msg: String) extends Exception 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/Module.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | 5 | object Module extends morphir.ir.module.ModuleModule 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Example Project 2 | 3 | This project is just here to provide some functions to be tested by example-project-tests -------------------------------------------------------------------------------- /morphir/runtime/js/src/org/finos/morphir/runtime/MorphirRuntimePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait MorphirRuntimePlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/runtime/jvm/src/org/finos/morphir/runtime/MorphirRuntimePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait MorphirRuntimePlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/dsl/attributed.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.dsl 2 | 3 | //TODO: Add syntax that works with Attributes 4 | object attributed {} 5 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/dsl/utype.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.dsl 2 | 3 | //TODO: Add syntax for dealing with VA = UType and TA = Unit 4 | object utype 5 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/syntax/AllSyntax.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.syntax 2 | 3 | trait AllSyntax extends NamingSyntax 4 | 5 | object all extends AllSyntax 6 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/HasFQNameInfo.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | trait HasFQNameInfo { 4 | def fqNameInfo: FQNameInfo 5 | } 6 | -------------------------------------------------------------------------------- /archived/lang/test/src/org/finos/morphir/samples/Hello.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.samples 2 | 3 | object Hello: 4 | def greet(name: String): String = s"Hello, $name" 5 | -------------------------------------------------------------------------------- /morphir/runtime/js/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait EvaluationLibraryPlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/runtime/native/src/org/finos/morphir/runtime/MorphirRuntimePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait MorphirRuntimePlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/util/UnsupportedException.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util 2 | 3 | final case class UnsupportedException(msg: String) extends Exception 4 | -------------------------------------------------------------------------------- /archived/lang/src/org/finos/morphir/lang/scaladsl/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang 2 | 3 | package object scaladsl { 4 | export internal.BundlerMacro.bundle 5 | } 6 | -------------------------------------------------------------------------------- /morphir-local: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # construct a fat jar locally 4 | ./mill morphir.main.assembly 5 | 6 | exec java -jar ./out/morphir/main/assembly.dest/out.jar "$@" 7 | 8 | -------------------------------------------------------------------------------- /morphir/runtime/native/src/org/finos/morphir/runtime/EvaluationLibraryPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait EvaluationLibraryPlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/PackageModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | 5 | object PackageModule extends morphir.ir.packages.PackageModule 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Defaults", 3 | "sourceDirectory": "src", 4 | "exposedModules": [ 5 | "Defaults" 6 | ] 7 | } -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/EvaluationLibrary.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | object EvaluationLibrary extends EvaluationLibraryPlatformSpecific {} 4 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/Attributed.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | final case class Attributed[Case[+_], A](caseValue: Case[Attributed[Case, A]], attributes: A) 4 | -------------------------------------------------------------------------------- /morphir/tools/js/src/fs2/io/platform/js/PathHelper.scala: -------------------------------------------------------------------------------- 1 | package fs2.io.platform.js 2 | 3 | object PathHelper { 4 | val homeDir: String = fs2.io.internal.facade.os.homedir() 5 | } 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/.gitignore: -------------------------------------------------------------------------------- 1 | # Morphir files should no longer be checked in since they are generated as part of the build 2 | morphir-hashes.json 3 | morphir-ir.json -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Example Project 2 | 3 | This project is just here to provide some functions to be tested by example-project-tests -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/Codec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.codec 2 | 3 | trait Codec[Whole, Element, A] extends Encoder[Whole, Element, A] with Decoder[Whole, Element, A] 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | sbt linguist-vendored 2 | website/* linguist-vendored 3 | docs/* linguist-vendored 4 | 5 | # Treat huge morphir json blobs as binary files. Don't show diff 6 | morphir-ir.json binary 7 | -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Morphir.UnitTest", 3 | "sourceDirectory": "src", 4 | "exposedModules": [ 5 | "Test", 6 | "Expect" 7 | ] 8 | } -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/functional/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | package object functional { 4 | type Id[+A] = Id.Type[A] 5 | object Id extends IdNewtypeEncoding {} 6 | } 7 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/Gens.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import org.finos.morphir.ir.generator.LiteralGen 4 | 5 | object Gens extends LiteralGen 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/unit-test-framework/example-project/bun.lockb -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/HasConceptId.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | import org.finos.morphir.universe.ir.* 4 | 5 | trait HasConceptId { 6 | def id: ConceptId 7 | } 8 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Example", 3 | "sourceDirectory": "src", 4 | "exposedModules": [ 5 | "ExampleModule" 6 | ] 7 | } -------------------------------------------------------------------------------- /morphir/contrib/knowledge/src/morphir/kb/logic/core/FieldConstraint.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic.core 2 | 3 | object FieldConstraint { 4 | val unconstrained: FieldConstraint = { case s => s } 5 | } 6 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/Distribution.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import org.finos.morphir.ir.distribution.DistributionModule 4 | 5 | object Distribution extends DistributionModule 6 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/mir.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | import org.finos.morphir.internal.{AllMiscModules, AllTypeLevelModules} 3 | object mir extends AllMiscModules with AllTypeLevelModules {} 4 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/IRReadWriters.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import upickle.implicits.MacroImplicits 4 | trait IRReadWriters extends upickle.core.Types with MacroImplicits {} 5 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/unit-test-framework/example-project-tests/bun.lockb -------------------------------------------------------------------------------- /mill-build/src/millbuild/crossplatform/DevMode.scala: -------------------------------------------------------------------------------- 1 | package millbuild.crossplatform 2 | import mill._ 3 | 4 | object DevMode { 5 | val devMode: Boolean = System.getenv("MORPHIR_SCALA_DEV_MODE") == "true" 6 | } 7 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Morphir.Examples", 3 | "sourceDirectory": "src/elm", 4 | "exposedModules": [ 5 | "Accounting.TAccount", 6 | "Accounting.Journal" 7 | ] 8 | } -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Examples 2 | 3 | This project exists to let us test the unit testing functionality itself, and as a reference for how tests can be written. -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/datamodel/DeriverTypes.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | object DeriverTypes { 4 | type IsProduct[P <: scala.Product] = P 5 | type IsOption[P <: Option[_]] = P 6 | } 7 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Examples 2 | 3 | This project exists to let us test the unit testing functionality itself, and as a reference for how tests can be written. -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/bun.lockb -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/extensions.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | import org.finos.morphir.extensibility.ExtensionsModule 3 | object extensions extends ExtensionsModule(org.finos.morphir.mir) {} 4 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/ReadMe.md: -------------------------------------------------------------------------------- 1 | ## Examples 2 | 3 | This project exists to let us test the unit testing functionality itself, and as a reference for how tests can be written. -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/UnionType.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | sealed trait UnionType 4 | object UnionType { 5 | case object Enum extends UnionType 6 | case object Sum extends UnionType 7 | } 8 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/finos/morphir-scala/HEAD/examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/bun.lockb -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/functional/TypeTagging.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.functional 2 | 3 | object TypeTagging { 4 | type @@[T, Tag] = T with Tag 5 | 6 | def tag[T, Tag](t: T): T @@ Tag = t.asInstanceOf[T @@ Tag] 7 | } 8 | -------------------------------------------------------------------------------- /archived/lang/test/src/org/finos/morphir/samples/Basics.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.samples 2 | 3 | object Basics: 4 | opaque type Bool = scala.Boolean 5 | opaque type Int = scala.Int 6 | opaque type String = java.lang.String 7 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/predef.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | import zio.prelude._ 4 | object predef { 5 | type Environment = Environment.Type 6 | object Environment extends Newtype[CallStack] 7 | } 8 | -------------------------------------------------------------------------------- /mill-build/src/mill/local/plugins/ci/release/Discover.scala.scala: -------------------------------------------------------------------------------- 1 | package mill.local.plugins.ci.release 2 | 3 | private[release] object Discover { 4 | implicit def millEvaluatorTokenReader = mill.main.TokenReaders.millEvaluatorTokenReader 5 | } 6 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/semver/Constraint.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm.semver 2 | 3 | final case class Constraint(set: Set[Range]) 4 | 5 | object Constraint { 6 | val empty: Constraint = Constraint(Set.empty) 7 | } 8 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/MorphirIRFile.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | 4 | import org.finos.morphir.ir.Distribution.Distribution 5 | 6 | final case class MorphirIRFile(version: MorphirIRVersion, distribution: Distribution) 7 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/Encoder.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.codec 2 | 3 | import zio.stream.ZPipeline 4 | trait Encoder[Whole, Element, -A] { 5 | def encode(value: A): Whole 6 | def streamEncoder: ZPipeline[Any, Nothing, A, Element] 7 | } 8 | -------------------------------------------------------------------------------- /.github/scripts/wrap-gpg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p ~/mybin 4 | touch ~/mybin/gpg 5 | chmod +x ~/mybin/gpg 6 | echo '#!/usr/bin/env sh' > ~/mybin/gpg 7 | echo "$(which gpg) --no-tty --yes \"\$@\"" >> ~/mybin/gpg 8 | echo "$HOME/mybin" >> $GITHUB_PATH 9 | -------------------------------------------------------------------------------- /archived/concepts/src/org/finos/morphir/concepts/Distro.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir.concepts 3 | 4 | import morphir.core.types.Versioning.MorphirVersion 5 | 6 | enum Distro: 7 | case Library 8 | case Bundle(morphirVersion: MorphirVersion) 9 | -------------------------------------------------------------------------------- /archived/core/test/src/org/finos/morphir/core/CoreModuleSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | 5 | object CoreModuleSpec extends MorphirBaseSpec { 6 | def spec = suite("CoreModuleSpec")() 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/NOTICE.md: -------------------------------------------------------------------------------- 1 | # Notice 2 | 3 | This product includes code derived from the following: 4 | 5 | - [zio-schema](https://github.dev/zio/zio-schema) that is licensed under the [Apache License, Version 2.0](https://github.dev/zio/zio-schema) -------------------------------------------------------------------------------- /morphir/tools/jvm-native/src/org/finos/morphir/util/vfile/VFilePlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | import java.nio.file.Path 3 | 4 | trait VFilePlatformSpecific { 5 | def fileRef(path: Path): VFile = VFile.fileRef(VPath(path)) 6 | } 7 | -------------------------------------------------------------------------------- /archived/concepts/src/org/finos/morphir/concepts/workspace/Workspace.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package concepts 4 | package workspace 5 | 6 | import java.nio.file.Path 7 | 8 | final case class Workspace(path: Path) 9 | object Workspace 10 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/elm-tooling.json: -------------------------------------------------------------------------------- 1 | { 2 | "tools": { 3 | "elm": "0.19.1", 4 | "elm-format": "0.8.7", 5 | "elm-json": "0.2.13", 6 | "elm-test-rs": "3.0.0" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/package.scala: -------------------------------------------------------------------------------- 1 | package object millbuild { 2 | implicit final class SeqOps[A](val self: Seq[A]) extends AnyVal { 3 | def concatIf(condition: => Boolean)(values: A*): Seq[A] = 4 | if (condition) self ++ values else self 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /morphir/lib/interop/src/org/finos/morphir/runtime/UndefinedBehaviorError.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package runtime 4 | 5 | /** 6 | * An exception that is thrown whenever an 7 | */ 8 | final class UndefinedBehaviorError extends java.lang.Error 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codecs/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | package object codecs { 4 | 5 | // NOTE: Wrote this way so you can also say Out Encoder Data i.e. JSON Encoder Person 6 | type Encoder[Out, Data] = Writer[Any, Data, Out] 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/PackageDefinition.scala: -------------------------------------------------------------------------------- 1 | // package org.finos.morphir.universe.ir 2 | 3 | // import zio.prelude.* 4 | 5 | // final case class PackageDefinition[+TA, +VA](modules: Map[ModuleName, AccessControlled[Module.Definition[TA, VA]]]) 6 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/Transformer.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import upickle.core.Visitor 4 | trait Transformer[I] { 5 | def transform[T](j: I, f: Visitor[_, T]): T 6 | def transformable[T](j: I) = Readable.fromTransformer(j, this) 7 | } 8 | -------------------------------------------------------------------------------- /archived/core/test/src/org/finos/morphir/example/VisitorUsage.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package example 3 | 4 | import core.types.Versioning.MorphirVersion 5 | 6 | object VisitorUsage { 7 | val morphirVersion: MorphirVersion = MorphirVersion("1.2.3") 8 | } 9 | -------------------------------------------------------------------------------- /mill-build/src/mill/local/plugins/ci/release/Eval.scala: -------------------------------------------------------------------------------- 1 | package mill.local.plugins.ci.release 2 | 3 | import mill.eval.Evaluator 4 | 5 | private[release] object Eval { 6 | 7 | def evalOrThrow(ev: Evaluator): Evaluator.EvalOrThrow = ev.evalOrThrow() 8 | 9 | } 10 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/src/org/finos/morphir/ir/json/MorphirJsonSupport.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.json 2 | 3 | trait MorphirJsonSupport extends MorphirJsonEncodingSupport with MorphirJsonDecodingSupport 4 | object MorphirJsonSupport extends MorphirJsonSupport 5 | -------------------------------------------------------------------------------- /morphir/lib/interop/src/org/finos/morphir/interop/extern.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.interop 2 | import org.finos.morphir.runtime 3 | 4 | final class extern extends scala.annotation.StaticAnnotation 5 | object extern { 6 | def apply: Nothing = runtime.intrinsic 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/core/capabilities/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core 2 | 3 | package object capabilities { 4 | implicit class ShowOps[A](val self: A) extends AnyVal { 5 | def show(implicit ev: Show[A]): String = ev.show(self) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/internal/all.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.internal 2 | 3 | trait AllTypeLevelModules 4 | extends TypeSpecModule 5 | with TypeDefModule 6 | with TypeInfoModule 7 | with TypeOfModule {} 8 | 9 | trait AllMiscModules 10 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/Resolver.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | trait Resolver extends Product with Serializable 4 | 5 | object Resolver { 6 | val default: Resolver = Default() 7 | final case class Default() extends Resolver 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/MorphirNumber.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | //TODO: Evaluate if still needed 4 | trait MorphirNumber[A] {} 5 | 6 | object MorphirNumber { 7 | def apply[A](implicit ev: MorphirNumber[A]): MorphirNumber[A] = ev 8 | } 9 | -------------------------------------------------------------------------------- /morphir/tests/test/js/src/org/finos/morphir/util/vfile/VPathSpecPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | import zio.test._ 3 | trait VPathSpecPlatformSpecific { self: VPathSpec.type => 4 | def platformSpecificSuite = suite("PlatformSpecific")() 5 | } 6 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "automerge": true, 3 | "rebaseWhen": "conflicted", 4 | "labels": ["type: dependencies"], 5 | "packageRules": [ 6 | { 7 | "matchManagers": [ 8 | "sbt" 9 | ], 10 | "enabled": false 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/src/org/finos/morphir/ir/json/MorphirJsonSupportV1.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.json 2 | 3 | trait MorphirJsonSupportV1 extends MorphirJsonEncodingSupportV1 with MorphirJsonDecodingSupportV1 4 | object MorphirJsonSupportV1 extends MorphirJsonSupportV1 5 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/src/org/finos/morphir/ir/json/MorphirJsonSupportV2.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.json 2 | 3 | trait MorphirJsonSupportV2 extends MorphirJsonEncodingSupportV2 with MorphirJsonDecodingSupportV2 4 | object MorphirJsonSupportV2 extends MorphirJsonSupportV2 5 | -------------------------------------------------------------------------------- /morphir/testing/compiler/interface/src/scala/morphir/api/CompilationFailedException.java: -------------------------------------------------------------------------------- 1 | package scala.morphir.api; 2 | 3 | public class CompilationFailedException extends Exception { 4 | public CompilationFailedException(String message) { 5 | super(message); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /morphir/tests/src-3/org/finos/morphir/datamodel/testModels.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | case class Person(fName: String, lName: Int) 4 | object Joe { 5 | def unapply(p: Person) = 6 | if (p.fName == "Joe") Some((p.fName, p.lName)) 7 | else None 8 | } 9 | -------------------------------------------------------------------------------- /morphir/contrib/knowledge/src/morphir/kb/logic/microkanren.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic 2 | 3 | object microkanren extends Kernel { 4 | 5 | implicit class MicrokanrenSyntax[A](val self: A) extends AnyVal { 6 | def ===[B](that: B): Goal = equal(self, that) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /morphir/tests/test/js/src/org/finos/morphir/util/vfile/VFileSpecPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import zio.test._ 4 | 5 | trait VFileSpecPlatformSpecific { self: VFileSpec.type => 6 | def platformSpecificSuite = suite("PlatformSpecific")() 7 | } 8 | -------------------------------------------------------------------------------- /morphir/lib/interop/src/org/finos/morphir/runtime/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | 4 | package object runtime { 5 | @noinline def throwUndefined(): Nothing = 6 | throw new UndefinedBehaviorError 7 | 8 | def intrinsic: Nothing = throwUndefined() 9 | } 10 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/Attributes.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | trait Attributes { 3 | def isEmpty: Boolean 4 | } 5 | 6 | object Attributes { 7 | sealed trait Binding extends Product with Serializable { 8 | def keyId: ConceptId 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/Cmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | trait Cmdlet[-Args, +E] { 8 | def run(cmd: Args): ZIO[ZIOAppArgs, E, Any] 9 | } 10 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/printing/PPrint.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.printing 2 | 3 | trait PPrint[T] { 4 | def render(value: T): Option[pprint.Tree] 5 | } 6 | 7 | object PPrint 8 | 9 | trait PPrintLow0 { 10 | implicit def noPPrint[T]: PPrint[T] = _ => None 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/semver/Range.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm.semver 2 | 3 | final case class Range(lower: Interval, upper: Interval) 4 | object Range { 5 | def apply(version: Version): Range = 6 | Range(Interval.Closed(version), Interval.Closed(version)) 7 | } 8 | -------------------------------------------------------------------------------- /morphir/tools/launcher/test/src/org/finos/morphir/launcher/MorphirVersionTest.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.launcher 2 | 3 | case class MorphirVersionTest( 4 | defaultVersion: String, 5 | versionFromEnv: Option[String], 6 | versionFromFile: Option[String] 7 | ) extends MorphirVersion 8 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/core/types/Versioning.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package core.types 4 | 5 | import zio.prelude.* 6 | object Versioning { 7 | type MorphirVersion = MorphirVersion.Type 8 | 9 | object MorphirVersion extends Newtype[String] {} 10 | } 11 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/datamodel/EnumTranslation.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | sealed trait EnumTranslation 4 | object EnumTranslation { 5 | case object MutiFieldConstructor extends EnumTranslation 6 | case object SingleFieldWithRecord extends EnumTranslation 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/Hints.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | trait Hints { 4 | def isEmpty: Boolean 5 | } 6 | 7 | object Hints { 8 | val empty: Hints = Impl() 9 | 10 | final case class Impl() extends Hints { 11 | override def isEmpty: Boolean = true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/tools/js/src/org/finos/morphir/util/vfile/VPathCompanionApi.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import fs2.io.file.Path 4 | import fs2.io.platform.js.PathHelper 5 | 6 | abstract class VPathCompanionApi { 7 | 8 | def userHome: VPath = VPath(Path(PathHelper.homeDir)) 9 | } 10 | -------------------------------------------------------------------------------- /morphir/meta/src-3/org/finos/morphir/deriving/lazy_.scala: -------------------------------------------------------------------------------- 1 | // This file was taken from/originally ispired by the shapely project: https://gitlab.com/fommil/shapely 2 | package org.finos.morphir.meta 3 | 4 | trait LazyCompat { this: Lazy.type => 5 | implicit def gen[A](implicit A: => A): Lazy[A] = Lazy(A) 6 | } 7 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.java] 4 | end_of_line = lf 5 | insert_final_newline = true 6 | charset = utf-8 7 | indent_style = space 8 | indent_size = 4 9 | 10 | [*.{scala,sc}] 11 | end_of_line = lf 12 | insert_final_newline = true 13 | charset = utf-8 14 | indent_style = space 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/EnumTest.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.App.EnumTest exposing (..) 2 | 3 | import Morphir.Examples.App.TestUtils exposing (..) 4 | 5 | 6 | type Amount 7 | = Amount Int 8 | 9 | 10 | amount : Amount 11 | amount = 12 | Amount 123 13 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/MorphirRuntimeSetup.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | import org.finos.morphir.internal.AllTypeLevelModules 4 | import org.finos.morphir.runtime.extensions._ 5 | case class MorphirRuntimeSetup[+TA, +VA](ir: AllTypeLevelModules)(extensions: List[RuntimeExtension]) 6 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/TestUtils.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.App.TestUtils exposing (..) 2 | 3 | 4 | type alias TestContext = 5 | {} 6 | 7 | 8 | test : TestContext -> a -> a 9 | test context res = 10 | case context of 11 | _ -> 12 | res 13 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/InferredTypeOf.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | import org.finos.morphir.ir.Type.UType 3 | 4 | trait InferredTypeOf[A] { 5 | def inferredType(value: A): UType 6 | } 7 | 8 | object InferredTypeOf { 9 | def apply[A](implicit ev: InferredTypeOf[A]): InferredTypeOf[A] = ev 10 | } 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Support_question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🤗 Support Question 3 | about: If you have a question about configuration, usage, etc. 💬 4 | 5 | --- 6 | 7 | ## Support Question 8 | 9 | ...ask your question here. 10 | 11 | ...be sure to search existing issues since someone might have already asked something similar. 12 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: ['master'] 6 | 7 | jobs: 8 | update_release_draft: 9 | runs-on: ubuntu-20.04 10 | steps: 11 | - uses: release-drafter/release-drafter@v6 12 | env: 13 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/packages/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | 5 | package object packages { 6 | 7 | final type USpecification = morphir.ir.packages.Specification[Any] 8 | final val USpecification: morphir.ir.packages.Specification.type = morphir.ir.packages.Specification 9 | } 10 | -------------------------------------------------------------------------------- /morphir/tools/launcher/test/src/org/finos/morphir/launcher/CoursierTest.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.launcher 2 | 3 | import coursier.Dependency 4 | 5 | case class CoursierTest() extends Coursier { 6 | var fetched: Vector[Dependency] = Vector.empty 7 | override def fetch(deps: Dependency*): Unit = fetched ++= deps 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/universe/ir/IsNotAType.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | import scala.util.NotGiven 4 | 5 | sealed abstract class IsNotAType[-A] extends Serializable 6 | object IsNotAType extends IsNotAType[Any] { 7 | implicit def isNotAType[A](using NotGiven[A <:< Type[_]]): IsNotAType[A] = IsNotAType 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/services/kernel/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.services 2 | import zio._ 3 | package object kernel { 4 | type MorphirKernel = Kernel 5 | object MorphirKernel { 6 | def live: ZEnvironment[MorphirKernel] = ZEnvironment[Kernel]( 7 | Kernel.live 8 | ) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/distribution/DistributionSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package distribution 4 | 5 | import org.finos.morphir.testing.MorphirBaseSpec 6 | import zio.test._ 7 | 8 | object DistributionSpec extends MorphirBaseSpec { 9 | def spec = suite("Distribution Spec")() 10 | } 11 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/src/org/finos/morphir/ir/json/JsonEncodingHelpers.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.json 2 | 3 | import zio.json._ 4 | import zio.json.ast.Json 5 | 6 | trait JsonEncodingHelpers { 7 | final private[json] def toJsonAstOrThrow[A](a: A)(implicit encoder: JsonEncoder[A]): Json = 8 | a.toJsonAST.toOption.get 9 | } 10 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/ir/internal/validators.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package internal 4 | 5 | import zio.prelude._ 6 | 7 | object NonEmptyStringValidator 8 | extends Validator[String](str => 9 | if str.isEmpty then Left(AssertionError.Failure("is non-empty String.")) else Right(()) 10 | ) 11 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/SimpleTests.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.App.SimpleTests exposing (..) 2 | 3 | import Morphir.Examples.App.TestUtils exposing (..) 4 | 5 | 6 | {-| Test: Simple/Unit 7 | expected = () 8 | -} 9 | simpleUnitTest : TestContext -> () 10 | simpleUnitTest ctx = 11 | test ctx () 12 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/util/vfile/VFileSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.test._ 5 | 6 | object VFileSpec extends MorphirBaseSpec with VFileSpecPlatformSpecific { 7 | def spec = suite("VFileSpec")( 8 | platformSpecificSuite 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /morphir/contrib/knowledge/src/morphir/kb/logic/core/package.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic 2 | import zio.stream.ZStream 3 | package object core { 4 | type FieldConstraint = PartialFunction[State, State] 5 | type Name = String 6 | type Value = Any 7 | type SStream = Flux[State] 8 | val SStream = Flux 9 | } 10 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/SingleTestResult.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | sealed trait SingleTestResult {} 3 | object SingleTestResult { 4 | case object Passed extends SingleTestResult 5 | case class Failed(msg: String) extends SingleTestResult 6 | case class Err(e: Throwable) extends SingleTestResult 7 | } 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeConstructor.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | import org.finos.morphir.naming.* 3 | 4 | import Type.* 5 | import zio.Chunk 6 | 7 | final case class TypeConstructor[+A](name: Name, args: TypeConstructorArgs[A]) { 8 | def map[B](f: A => B): TypeConstructor[B] = copy(args = args.map(f)) 9 | } 10 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/config/lang/elm/ElmConfig.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.config.lang.elm 2 | import org.finos.morphir.util.vfile.VPath 3 | 4 | final case class ElmConfig(elmHome: VPath) 5 | object ElmConfig { 6 | val default: ElmConfig = { 7 | val elmHome = VPath.userHome / ".elm" 8 | ElmConfig(elmHome = elmHome) 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/api/MakeInputs.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.api 2 | import mill.api._ 3 | import mill.api.JsonFormatters._ 4 | 5 | final case class MakeInputs(sourceFiles: Seq[PathRef], incrementalBuildFiles: Seq[PathRef]) 6 | object MakeInputs { 7 | implicit val jsonFormatter: upickle.default.ReadWriter[MakeInputs] = upickle.default.macroRW 8 | } 9 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/services/sdk/MorphirSdk.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.services.sdk 2 | 3 | import zio.ZEnvironment 4 | 5 | class MorphirSdk 6 | 7 | // TODO This is superseded by NativeSDK. Perhaps it should be ZIO-Ified? 8 | object MorphirSdk { 9 | def live: ZEnvironment[MorphirSdk] = ZEnvironment[MorphirSdk](new MorphirSdk()) 10 | } 11 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/finance", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/Label.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | case class Label(value: String) 4 | 5 | sealed trait EnumLabel 6 | object EnumLabel { 7 | def apply(value: String): EnumLabel = EnumLabel.Named(value) 8 | 9 | case object Empty extends EnumLabel 10 | case class Named(value: String) extends EnumLabel 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ConceptId.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | import org.finos.morphir.universe.ir.* 4 | 5 | final case class ConceptId(namespace: String, name: String) extends HasConceptId { 6 | override def id: ConceptId = this 7 | } 8 | 9 | object ConceptId { 10 | final case class Member(conceptId: ConceptId, member: String) 11 | } 12 | -------------------------------------------------------------------------------- /morphir-cli-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # Coursier script 4 | # installs the latest published version of morphir-cli in the coursier directory 5 | # 6 | cs fetch org.finos.morphir:morphir-main_3:latest.release 7 | cs bootstrap org.finos.morphir:morphir-main_3:latest.release -M org.finos.morphir.cli.MorphirCliMain -f -o ~/Library/Application\ Support/Coursier/bin/morphir-cli 8 | -------------------------------------------------------------------------------- /morphir-elm/sdks/morphir-unit-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-elm/unit-test-framework", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/Names.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | trait Names 4 | extends FQNameModule 5 | with ModuleNameModule 6 | with NameModule 7 | with NamespaceModule 8 | with NodeIDModule 9 | with PathModule 10 | with PackageNameModule 11 | with QualifiedModuleNameModule 12 | with QNameModule 13 | with NamingOptionsModule 14 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/util/vfile/VPathSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import java.nio.file.Paths 4 | import org.finos.morphir.testing.MorphirBaseSpec 5 | import zio.test._ 6 | 7 | object VPathSpec extends MorphirBaseSpec with VPathSpecPlatformSpecific { 8 | def spec = suite("VPathSpec")( 9 | platformSpecificSuite 10 | ) 11 | } 12 | -------------------------------------------------------------------------------- /.github/workflows/auto-approve.yml: -------------------------------------------------------------------------------- 1 | name: Auto approve 2 | 3 | on: 4 | pull_request_target 5 | 6 | jobs: 7 | auto-approve: 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: hmarr/auto-approve-action@v4.0.0 11 | if: github.actor == 'scala-steward' || github.actor == 'renovate[bot]' 12 | with: 13 | github-token: "${{ secrets.GITHUB_TOKEN }}" 14 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/defaults-tests", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/src/Morphir/Examples/App/MyMap.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.App.MyMap exposing (..) 2 | 3 | import Morphir.Examples.App.TestUtils exposing (..) 4 | 5 | 6 | myMap : (a -> b) -> List a -> List b 7 | myMap f l = 8 | case l of 9 | head :: tail -> 10 | f head :: myMap f tail 11 | 12 | [] -> 13 | [] 14 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/RunConfiguration.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | import org.finos.morphir.ir.Distribution 4 | import org.finos.morphir.ir.Distribution.Distribution 5 | 6 | sealed trait RunConfiguration {} 7 | 8 | object RunConfiguration { 9 | final case class Standard(distributions: List[Distribution]) extends RunConfiguration 10 | } 11 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/ModuleNameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.generator 2 | import org.finos.morphir.naming.* 3 | 4 | import zio._ 5 | import zio.test.Gen 6 | 7 | trait ModuleNameGen { 8 | final val moduleName: Gen[Any, ModuleName] = PathGen.path.map(path => ModuleName(path)) 9 | } 10 | 11 | object ModuleNameGen extends ModuleNameGen 12 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/evaluator-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "morphir-scala-evaluator-tests", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.89.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/semver/Interval.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm.semver 2 | 3 | sealed trait Interval extends Product with Serializable { self => } 4 | object Interval { 5 | final case class Closed(version: Version) extends Interval 6 | final case class Open(version: Version) extends Interval 7 | case object Unbounded extends Interval 8 | } 9 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/PathGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.Gen 7 | 8 | trait PathGen { 9 | final def path: Gen[Any, Path] = Gen.listOfBounded(1, 5)(NameGen.name).map(parts => Path.fromList(parts)) 10 | } 11 | 12 | object PathGen extends PathGen 13 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/Readable.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import upickle.core.Visitor 4 | 5 | trait Readable { 6 | def transform[T](v: Visitor[_, T]): T 7 | } 8 | 9 | object Readable { 10 | case class fromTransformer[T](t: T, w: Transformer[T]) extends Readable { 11 | def transform[T](f: Visitor[_, T]): T = 12 | w.transform(t, f) 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/src/elm/Morphir/Examples/Accounting/Journal.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.Accounting.Journal exposing (..) 2 | 3 | import Morphir.SDK.LocalDate exposing (LocalDate) 4 | 5 | 6 | type alias Journal = 7 | { entries : List Entry 8 | , nextId : Int 9 | } 10 | 11 | 12 | type alias Entry = 13 | { id : Int 14 | , date : LocalDate 15 | } 16 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/functional/IdNewtypeEncoding.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.functional 2 | 3 | private[functional] abstract class IdNewtypeEncoding { 4 | opaque type Type[+A] <: A = A 5 | def apply[A](value: A): Type[A] = value 6 | extension [A](me: Type[A]) def value: A = me 7 | def unapply[A](instance: Type[A]): Option[A] = Some(instance) 8 | 9 | } 10 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/PackageNameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.generator 2 | 3 | import org.finos.morphir.naming._ 4 | import zio._ 5 | import zio.test.Gen 6 | 7 | trait PackageNameGen { 8 | final val packageName: Gen[Any, PackageName] = PathGen.path.map(path => PackageName(path)) 9 | } 10 | 11 | object PackageNameGen extends PackageNameGen 12 | -------------------------------------------------------------------------------- /.moon/tasks/tag-elm.yml: -------------------------------------------------------------------------------- 1 | fileGroups: 2 | elmSources: 3 | - "src" 4 | tasks: 5 | elm-lint: 6 | command: | 7 | elm-format @dirs(elmSources) @files(elmSources) --validate --yes 8 | inputs: 9 | - "@files(elmSources)" 10 | 11 | elm-format: 12 | command: | 13 | elm-format @dirs(elmSources) @files(elmSources) --yes 14 | inputs: 15 | - "@files(elmSources)" 16 | -------------------------------------------------------------------------------- /archived/core/test/src-3/org/finos/morphir/meta/PrintMacroUsage.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.meta 2 | 3 | object PrintMacroUsage: 4 | def greet(target: String): String = s"Hello, $target" 5 | def run(args: Array[String]): Unit = 6 | println(greet("World")) 7 | println("Running macro..") 8 | val result = PrintMacro.detailed { 9 | greet("42") 10 | } 11 | println(result) 12 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleTestsPassing", 3 | "sourceDirectory": "src", 4 | "localDependencies": [ 5 | "../../../../morphir-elm/sdks/morphir-unit-test/morphir-ir.json", 6 | "../example-project/morphir-ir.json" 7 | ], 8 | "exposedModules": [ 9 | "PassingModule" 10 | ] 11 | } -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/DumperVersionSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | //import Dumper.{given _} 4 | //import Dumper.Repr 5 | 6 | trait DumperVersionSpecific 7 | // given[A](using Dumper[A] 8 | // ):Dumper[IArray[A]] with 9 | // 10 | // def dumper(array: IArray[A]): Dumper.Repr = 11 | // Repr.VConstructor(List("scala"), "IArray", array.toList.map(_.dumpRepr)) 12 | //} 13 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/ir/IsNotAValue.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import scala.annotation.implicitNotFound 4 | import scala.util.NotGiven 5 | 6 | sealed abstract class IsNotAValue[-A] extends Serializable 7 | 8 | object IsNotAValue extends IsNotAValue[Any] { 9 | implicit def isNotAValue[A](using NotGiven[A <:< Value.Value[_, _]]): IsNotAValue[A] = IsNotAValue 10 | 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/Source.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | object Source { 4 | type Located[+A] = source.Located[A] 5 | val Located: source.Located.type = source.Located 6 | 7 | type Location = source.Location 8 | val Location: source.Location.type = source.Location 9 | 10 | type Region = source.Region 11 | val Region: source.Region.type = source.Region 12 | } 13 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/SetupCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | object SetupCmdlet extends Cmdlet[CliCommand.Setup, Exception] { 8 | def run(args: CliCommand.Setup) = 9 | for { 10 | _ <- printLine(s"Setting up: $args") 11 | } yield () 12 | } 13 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tasks: 3 | morphir-elm-make: 4 | deps: 5 | - "@morphir-elm/unit-test-framework:morphir-elm-make" 6 | - "@morphir-examples/unit-test-framework-example:morphir-elm-make" 7 | options: 8 | mergeDeps: 'prepend' 9 | tags: 10 | - "morphir" 11 | - "morphir-elm" 12 | - "elm" 13 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/InitCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | 4 | import zio._ 5 | import zio.Console.printLine 6 | import zio.process.Command 7 | 8 | object InitCmdlet extends Cmdlet[CliCommand.Init, Exception] { 9 | def run(args: CliCommand.Init) = 10 | for { 11 | _ <- printLine(s"Initializing: $args") 12 | } yield () 13 | } 14 | -------------------------------------------------------------------------------- /PROJECT.spdx: -------------------------------------------------------------------------------- 1 | SPDXVersion: SPDX-2.2 2 | DataLicense: CC0-1.0 3 | SPDXID: SPDXRef-DOCUMENT 4 | DocumentName: morphir-scala 5 | DocumentNamespace: https://github.com/finos/morphir-scala 6 | Creator: Organization: FINOS 7 | PackageName: morphir-scala 8 | PackageOriginator: FINOS 9 | PackageHomePage: https://github.com/finos/morphir-scala 10 | PackageLicenseDeclared: Apache-2.0 11 | SPDX-License-Identifier: Apache-2.0 -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | tasks: 3 | morphir-elm-make: 4 | deps: 5 | - "@morphir-elm/unit-test-framework:morphir-elm-make" 6 | - "@morphir-examples/unit-test-framework-example:morphir-elm-make" 7 | options: 8 | mergeDeps: 'prepend' 9 | tags: 10 | - "morphir" 11 | - "morphir-elm" 12 | - "elm" 13 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/functional/IsNotCovariant.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.functional 2 | 3 | import scala.util.NotGiven 4 | import zio.prelude.Covariant 5 | 6 | sealed abstract class IsNotCovariant[-A] extends Serializable 7 | object IsNotCovariant extends IsNotCovariant[Any] { 8 | implicit def isNotAType[F[+_], A](using NotGiven[Covariant[F]]): IsNotCovariant[F[A]] = IsNotCovariant 9 | } 10 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/AboutCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | 4 | import zio._ 5 | import zio.Console.printLine 6 | import zio.process.Command 7 | 8 | object AboutCmdlet extends Cmdlet[CliCommand.About.type, Exception] { 9 | def run(args: CliCommand.About.type) = 10 | for { 11 | _ <- printLine(s"About: $args") 12 | } yield () 13 | } 14 | -------------------------------------------------------------------------------- /.github/scripts/gpg-setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # from https://github.com/coursier/apps/blob/f1d2bf568bf466a98569a85c3f23c5f3a8eb5360/.github/scripts/gpg-setup.sh 4 | 5 | echo $PGP_SECRET | base64 --decode | gpg --import --no-tty --batch --yes 6 | 7 | echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf 8 | echo "pinentry-mode loopback" >>~/.gnupg/gpg.conf 9 | 10 | gpg-connect-agent reloadagent /bye 11 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/moon.yml: -------------------------------------------------------------------------------- 1 | platform: bun 2 | 3 | 4 | tasks: 5 | morphir-elm-make: 6 | deps: 7 | - "@morphir-elm/unit-test-framework:morphir-elm-make" 8 | - "@morphir-examples/unit-test-framework-example:morphir-elm-make" 9 | options: 10 | mergeDeps: 'prepend' 11 | 12 | tags: 13 | - "morphir" 14 | - "morphir-elm" 15 | - "elm" 16 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/WorkspaceCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | object WorkspaceCmdlet extends Cmdlet[CliCommand.Workspace, Exception] { 8 | def run(args: CliCommand.Workspace) = 9 | for { 10 | _ <- printLine(s"Workspace: $args") 11 | } yield () 12 | } 13 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/unit-test-framework-example", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/=!=.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | import scala.annotation.implicitNotFound 4 | import scala.util.NotGiven 5 | 6 | /// Evidence type `A` is not equal to type `B`. 7 | @implicitNotFound("${A} must not be equal to ${B}") 8 | abstract class =!=[A, B] extends Serializable 9 | object =!= { 10 | implicit def neq[A, B](implicit ev: NotGiven[A =!= B]): A =!= B = new =!=[A, B] {} 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/PackageSpecification.scala: -------------------------------------------------------------------------------- 1 | // package org.finos.morphir.universe.ir 2 | 3 | // import zio.prelude.* 4 | 5 | // final case class PackageSpecification[+TA](modules: Map[ModuleName, Module.Specification[TA]]) { 6 | // def map[B](f: TA => B): PackageSpecification[B] = PackageSpecification(modules.map { case (k, v) => k -> v.map(f) }) 7 | // } 8 | 9 | // object PackageSpecification {} 10 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/distribution/DistributionModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | package distribution 5 | 6 | trait DistributionModule { 7 | final type Distribution = morphir.ir.distribution.Distribution 8 | final val Distribution: morphir.ir.distribution.Distribution.type = morphir.ir.distribution.Distribution 9 | } 10 | 11 | object DistributionModule extends DistributionModule 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/RuntimeTypeExports.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | 3 | import zio.prelude.* 4 | import zio.prelude.fx.ZPure 5 | 6 | object exports { 7 | 8 | type RTAction[-R, +E, +A] = ZPure[Nothing, RTExecutionContext, RTExecutionContext, R, E, A] 9 | val RTAction: ZPure.type = ZPure 10 | 11 | type URTAction[+A] = RTAction[Any, Nothing, A] 12 | val URTAction: ZPure.type = ZPure 13 | } 14 | -------------------------------------------------------------------------------- /.github/workflows/github-dependency-review.yml: -------------------------------------------------------------------------------- 1 | name: 'Dependency Review' 2 | on: [pull_request] 3 | permissions: 4 | contents: read 5 | jobs: 6 | dependency-review: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: 'Checkout Repository' 10 | uses: actions/checkout@v4 11 | - name: Dependency Review 12 | uses: actions/dependency-review-action@v4 13 | with: 14 | fail-on-severity: high -------------------------------------------------------------------------------- /coursier-insiders-channel.json: -------------------------------------------------------------------------------- 1 | { 2 | "morphir-cli": { 3 | "repositories": [ 4 | "central", 5 | "sonatype:releases", 6 | "sonatype:snapshots", 7 | "typesafe:ivy-releases" 8 | ], 9 | "dependencies": [ 10 | "org.finos.morphir:morphir-main_3:latest.release" 11 | ], 12 | "maincClass": "org.finos.morphir.cli.MorphirCliMain" 13 | } 14 | } -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/unit-test-framework-example-tests", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/service/MorphirRuntimeDriver.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.service 2 | 3 | import zio._ 4 | 5 | trait MorphirRuntimeDriver { 6 | def test(): Task[Unit] 7 | } 8 | 9 | object MorphirRuntimeDriver extends MorphirRuntimeDriverPlatformSpecific { 10 | 11 | def test(): ZIO[MorphirRuntimeDriver, Throwable, Unit] = 12 | ZIO.serviceWithZIO[MorphirRuntimeDriver](_.test()) 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/ConceptId.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | import org.finos.morphir.naming.PackageName 4 | 5 | final case class ConceptId(namespace: PackageName, module: String, name: String) extends HasId { 6 | override def id: ConceptId = this 7 | } 8 | 9 | object ConceptId { self => } 10 | 11 | trait HasId { 12 | def id: ConceptId 13 | } 14 | 15 | trait ConceptTag[A] extends HasId {} 16 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/Named.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | import org.finos.morphir.naming._ 3 | final case class Named[+A](name: Name, value: A) { self => 4 | def map[B](f: A => B): Named[B] = Named(name, f(value)) 5 | def flatMap[B](f: A => Named[B]): Named[B] = f(value) 6 | } 7 | 8 | object Named { 9 | def apply[A](name: String, value: A): Named[A] = Named(Name.fromString(name), value) 10 | } 11 | -------------------------------------------------------------------------------- /morphir/tools/js/src/org/finos/morphir/service/ProcessIOPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import zio._ 4 | 5 | trait ProcessIOPlatformSpecific { 6 | val live: ULayer[ProcessIO] = ZLayer.succeed(ProcessIOLive) 7 | 8 | object ProcessIOLive extends ProcessIO { 9 | def exec(command: String, args: String*)(implicit trace: Trace): Task[ExitCode] = 10 | ZIO.succeed(ExitCode(0)) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleTestsIncomplete", 3 | "sourceDirectory": "src", 4 | "localDependencies": [ 5 | "../../../../morphir-elm/sdks/morphir-unit-test/morphir-ir.json", 6 | "../example-project/morphir-ir.json" 7 | ], 8 | "exposedModules": [ 9 | "IncompleteModule", 10 | "PassingModule" 11 | ] 12 | } -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/environment.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime 2 | import org.finos.morphir.runtime.services.kernel.MorphirKernel 3 | import org.finos.morphir.runtime.services.sdk.MorphirSdk 4 | import zio.* 5 | 6 | object environment { 7 | type MorphirEnv = MorphirSdk with MorphirKernel 8 | object MorphirEnv { 9 | def live: ZEnvironment[MorphirEnv] = MorphirSdk.live ++ MorphirKernel.live 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /morphir/tools/native/src/org/finos/morphir/service/ProcessIOPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import zio._ 4 | 5 | trait ProcessIOPlatformSpecific { 6 | val live: ULayer[ProcessIO] = ZLayer.succeed(ProcessIOLive) 7 | 8 | object ProcessIOLive extends ProcessIO { 9 | def exec(command: String, args: String*)(implicit trace: Trace): Task[ExitCode] = 10 | ZIO.succeed(ExitCode(0)) 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /morphir/build/integration/mill/morphir-elm/src/org/finos/morphir/mill/elm/MorphirElmModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.mill.elm 2 | import mill._ 3 | 4 | trait MorphirElmModule extends Module { 5 | def make: T[PathRef] = T { 6 | 7 | val outputFolder = T.ctx().dest 8 | val path = outputFolder / "morphir-ir.json" 9 | os.makeDir.all(outputFolder) 10 | os.write.over(path, "{}") 11 | PathRef(path) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/PathDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | object PathDeriveGen extends PathDeriveGen 10 | trait PathDeriveGen { 11 | implicit val pathDeriveGen: DeriveGen[Path] = DeriveGen.instance(PathGen.path) 12 | } 13 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/NameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import org.finos.morphir.testing.generators.WordGen 7 | import zio.test.Gen 8 | 9 | trait NameGen { 10 | final val name: Gen[Any, Name] = Gen.listOfBounded(1, 5)(WordGen.words).map(parts => Name.fromList(parts)) 11 | } 12 | 13 | object NameGen extends NameGen 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/NameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait NameDeriveGen { 10 | implicit val nameDeriveGen: DeriveGen[Name] = DeriveGen.instance(NameGen.name) 11 | } 12 | 13 | object NameDeriveGen extends NameDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/util/vfile/VFileProperties.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | import org.finos.morphir.util.attribs.Attribute 3 | 4 | import java.nio.charset.{Charset, StandardCharsets} 5 | object VFileProperties { 6 | 7 | val isEmpty: Attribute[Boolean] = 8 | Attribute("isEmpty", false) 9 | 10 | val characterSet: Attribute[Charset] = 11 | Attribute("characterSet", StandardCharsets.UTF_8) 12 | 13 | } 14 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-passing/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/unit-test-framework-example-tests-passing", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/api/Named.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.api 2 | 3 | final case class Named[+A](name: String, value: A) { 4 | def map[B](f: A => B): Named[B] = Named(name, f(value)) 5 | def flatMap[B](f: A => Named[B]): Named[B] = f(value) 6 | } 7 | 8 | object Named { 9 | implicit def jsonFormatter[A: upickle.default.ReadWriter]: upickle.default.ReadWriter[Named[A]] = 10 | upickle.default.macroRW 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/util/package.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | 4 | package object util { 5 | def unreachable: Nothing = 6 | throw UnreachableException 7 | 8 | def unsupported(v: Any): Nothing = 9 | throw UnsupportedException(s"$v (${v.getClass})") 10 | 11 | def unsupported(s: String = ""): Nothing = 12 | throw UnsupportedException(s) 13 | 14 | type UnreachableException = UnreachableException.type 15 | } 16 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests-incomplete/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@morphir-examples/unit-test-framework-example-tests-incomplete", 3 | "private": true, 4 | "devDependencies": { 5 | "elm-tooling": "^1.15.1", 6 | "morphir-elm": "^2.81.0" 7 | }, 8 | "scripts": { 9 | "postinstall": "elm-tooling install", 10 | "format": "elm-format --yes .", 11 | "make": "morphir-elm make" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/NamingOptionsModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | trait NamingOptionsModule { self: PackageNameModule with ModuleNameModule => 4 | 5 | sealed case class FQNamingOptions(defaultPackage: PackageName, defaultModule: ModuleName, defaultSeparator: String) 6 | 7 | object FQNamingOptions { 8 | implicit val default: FQNamingOptions = 9 | FQNamingOptions(PackageName.empty, ModuleName.empty, ":") 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/QNameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait QNameDeriveGen { 10 | implicit val qNameDeriveGen: DeriveGen[QName] = DeriveGen.instance(QNameGen.qName) 11 | } 12 | 13 | object QNameDeriveGen extends QNameDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/FQNameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait FQNameDeriveGen { 10 | implicit val fqNameDeriveGen: DeriveGen[FQName] = DeriveGen.instance(FQNameGen.fqName) 11 | } 12 | 13 | object FQNameDeriveGen extends FQNameDeriveGen 14 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | # morphir-scala - FINOS 2 | 3 | Copyright 2022 - 2022 FINOS 4 | 5 | This product includes software developed at the Fintech Open Source Foundation (https://www.finos.org/). 6 | 7 | This product includes source code from the following third-party libraries/projects: 8 | 9 | - [Shapely](https://gitlab.com/fommil/shapely) project which is [licensed](docs/licenses/shapely/LICENSE) under the [BSD 2-Clause "Simplified" License](https://gitlab.com/fommil/shapely). 10 | -------------------------------------------------------------------------------- /morphir/elm/facade/src/org/finos/morphir/elm/facade/CliFacade.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.elm.facade 2 | 3 | trait CliFacade[F[_]] { 4 | 5 | def make( 6 | projectDir: String = ".", 7 | outputPath: String = "morphir.json", 8 | typesOnly: Boolean = false, 9 | fallbackCli: Boolean = false 10 | ): F[Option[String]] 11 | } 12 | 13 | object CliFacade { 14 | def apply[F[_]](implicit instance: CliFacade[F]): CliFacade[F] = instance 15 | } 16 | -------------------------------------------------------------------------------- /morphir/lib/interop/src/org/finos/morphir/Default.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | class Default[+A](val default: A) 4 | 5 | object Default extends DefaultLowerPriorityInstances { 6 | implicit object DefaultUnit extends Default[Unit](()) 7 | 8 | def value[A](implicit value: Default[A]): A = value.default 9 | } 10 | 11 | trait DefaultLowerPriorityInstances { 12 | implicit def defaultNull[A <: AnyRef]: Default[A] = new Default(null.asInstanceOf[A]) 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/core/capabilities/Show.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core.capabilities 2 | 3 | trait Show[A] { 4 | def show(value: A): String 5 | } 6 | 7 | object Show extends ShowInstancesPriority0 { 8 | def apply[A](implicit ev: Show[A]): Show[A] = ev 9 | 10 | def fromToString[A]: Show[A] = _.toString() 11 | 12 | } 13 | 14 | private[core] trait ShowInstancesPriority0 { 15 | 16 | implicit def defaultInstance[A]: Show[A] = _.toString() 17 | } 18 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/PackageNameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.generator 2 | 3 | import org.finos.morphir.naming._ 4 | import zio.test.magnolia.DeriveGen 5 | import zio.test.magnolia.DeriveGen._ 6 | 7 | object PackageNameDeriveGen extends PackageNameDeriveGen 8 | trait PackageNameDeriveGen { 9 | implicit val packageNameDeriveGen: DeriveGen[PackageName] = DeriveGen.instance(PackageNameGen.packageName) 10 | } 11 | -------------------------------------------------------------------------------- /morphir/tools/jvm-native/src/org/finos/morphir/util/vfile/VPathCompanionApi.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import fs2.io.file.Path 4 | 5 | abstract class VPathCompanionApi { 6 | def apply(path: java.nio.file.Path): VPath = VPath(Path.fromNioPath(path)) 7 | def fromNioPath(path: java.nio.file.Path): VPath = VPath(Path.fromNioPath(path)) 8 | def userHome: VPath = VPath(Path(System.getProperty("user.home"))) 9 | } 10 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/service/ProcessIO.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import zio._ 4 | 5 | trait ProcessIO { 6 | def exec(command: String, args: String*)(implicit trace: Trace): Task[ExitCode] 7 | } 8 | 9 | object ProcessIO extends ProcessIOPlatformSpecific { 10 | def exec(command: String, args: String*)(implicit trace: Trace): ZIO[ProcessIO, Throwable, ExitCode] = 11 | ZIO.serviceWithZIO[ProcessIO](_.exec(command, args: _*)) 12 | } 13 | -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/api/MorphirProjectConfig.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.api 2 | 3 | final case class MorphirProjectConfig( 4 | name: String, 5 | sourceDirectory: String, 6 | exposedModules: List[String], 7 | dependencies: List[String], 8 | localDependencies: List[String] 9 | ) 10 | 11 | object MorphirProjectConfig { 12 | implicit val jsonFormatter: upickle.default.ReadWriter[MorphirProjectConfig] = upickle.default.macroRW 13 | } 14 | -------------------------------------------------------------------------------- /morphir/tests/src/org/finos/morphir/testing/model/models.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.testing.model 2 | 3 | import org.finos.morphir.annotation._ 4 | import org.finos.morphir.naming._ 5 | import org.finos.morphir.mir._ 6 | 7 | @qualifiedModuleName("Morphir.SDK.Test", "Model") 8 | final case class Person(name: String, age: Int) 9 | 10 | @fullyQualifiedName("Morphir.SDK.Testing", "Test.Models", "Employee") 11 | final case class Employee(name: String, age: Int, salary: Int) 12 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project-tests/morphir.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ExampleTests", 3 | "sourceDirectory": "src", 4 | "localDependencies": [ 5 | "../../../../morphir-elm/sdks/morphir-unit-test/morphir-ir.json", 6 | "../example-project/morphir-ir.json" 7 | ], 8 | "exposedModules": [ 9 | "FailingModuleOne", 10 | "FailingModuleTwo", 11 | "IncompleteModule", 12 | "PassingModule" 13 | ] 14 | } -------------------------------------------------------------------------------- /morphir/tools/jvm/src/org/finos/morphir/service/ProcessIOPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import zio._ 4 | import zio.process._ 5 | 6 | trait ProcessIOPlatformSpecific { 7 | val live: ULayer[ProcessIO] = ZLayer.succeed(ProcessIOLive) 8 | 9 | object ProcessIOLive extends ProcessIO { 10 | def exec(command: String, args: String*)(implicit trace: Trace): Task[ExitCode] = 11 | Command(command, args: _*).inheritIO.exitCode 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/config/WorkspaceConfig.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.config 2 | import lang.elm.ElmConfig 3 | 4 | final case class WorkspaceConfig(lang: LanguagesConfig) 5 | object WorkspaceConfig { 6 | val default: WorkspaceConfig = WorkspaceConfig(LanguagesConfig.default) 7 | } 8 | 9 | final case class LanguagesConfig( 10 | elm: ElmConfig 11 | ) 12 | object LanguagesConfig { 13 | val default: LanguagesConfig = LanguagesConfig(ElmConfig.default) 14 | } 15 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/defaults-tests/elm.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "package", 3 | "name": "finos/morphir-defaults-tests", 4 | "summary": "Test Project for Defaults", 5 | "license": "Apache-2.0", 6 | "version": "1.0.0", 7 | "exposed-modules": [], 8 | "elm-version": "0.19.0 <= v < 0.20.0", 9 | "dependencies": { 10 | "elm/core": "1.0.0 <= v < 2.0.0", 11 | "finos/morphir-elm": "21.0.1 <= v < 22.0.0" 12 | }, 13 | "test-dependencies": {} 14 | } -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/api/MakeResult.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.api 2 | 3 | import mill.PathRef 4 | import mill.api.JsonFormatters._ 5 | 6 | case class MakeResult( 7 | makeArgs: MakeArgs, 8 | irFilePath: PathRef, 9 | commandArgs: Seq[String], 10 | workingDir: os.Path, 11 | morphirHashesPath: Option[PathRef] = None 12 | ) 13 | object MakeResult { 14 | implicit val jsonFormatter: upickle.default.ReadWriter[MakeResult] = upickle.default.macroRW 15 | } 16 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeConstructorArg.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | import org.finos.morphir.naming.* 3 | 4 | import Type.* 5 | import zio.Chunk 6 | 7 | final case class TypeConstructorArg[+A](name: Name, tpe: Type[A]) { 8 | def map[B](f: A => B): TypeConstructorArg[B] = TypeConstructorArg(name, tpe.map(f)) 9 | } 10 | 11 | object TypeConstructorArg { 12 | implicit def toTuple[A](arg: TypeConstructorArg[A]): (Name, Type[A]) = (arg.name, arg.tpe) 13 | } 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ModuleNameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait ModuleNameDeriveGen { 10 | implicit val moduleNameDeriveGen: DeriveGen[ModuleName] = DeriveGen.instance(ModuleNameGen.moduleName) 11 | } 12 | 13 | object ModuleNameDeriveGen extends ModuleNameDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/Not.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | import scala.annotation.implicitNotFound 3 | import scala.util.NotGiven 4 | 5 | /** 6 | * Provides implicit evidence that an instance of `A` is not in implicit scope. 7 | */ 8 | @implicitNotFound("Implicit ${A} defined.") 9 | sealed trait Not[A] 10 | object Not { 11 | 12 | /** 13 | * Derives a `Not[A]` instance from a `NotGiven[A]` instance. 14 | */ 15 | implicit def Not[A: NotGiven]: Not[A] = 16 | new Not[A] {} 17 | } 18 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/MorphirIRVersion.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | 4 | sealed abstract class MorphirIRVersion(version: String) extends Product with Serializable { 5 | final val versionNumber: String = version 6 | } 7 | 8 | object MorphirIRVersion { 9 | case object V1_0 extends MorphirIRVersion("1.0") 10 | case object V2_0 extends MorphirIRVersion("2.0") 11 | case object V3_0 extends MorphirIRVersion("3.0") 12 | 13 | val Default: MorphirIRVersion = V3_0 14 | } 15 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/QualifiedModuleNameSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import org.finos.morphir.naming._ 4 | import org.finos.morphir.testing.MorphirBaseSpec 5 | import zio.test.* 6 | 7 | object QualifiedModuleNameSpec extends MorphirBaseSpec { 8 | def spec = suite("QualifiedModuleName Spec")( 9 | // test("fromString") { 10 | // assertTrue(QualifiedModuleName.fromString("Basics") == QualifiedModuleName.unsafeMake()("basics")) 11 | // } 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/source/Region.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.source 2 | import zio.prelude._ 3 | final case class Region(start: Location, end: Location) 4 | object Region { 5 | val default: Region = Region(Location.default, Location.default) 6 | implicit val RegionIdentity: Identity[Region] = new Identity[Region] { 7 | lazy val identity: Region = default 8 | 9 | override def combine(l: => Region, r: => Region): Region = Region(l.start <> r.start, l.end <> r.end) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/DocumentedDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait DocumentedDeriveGen { 9 | implicit def documentedDeriveGen[A: DeriveGen]: DeriveGen[Documented[A]] = 10 | DeriveGen.instance(DocumentedGen.documentedFromAttributes(DeriveGen[A])) 11 | } 12 | 13 | object DocumentedDeriveGen extends DocumentedDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/FieldDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.Type.Field 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait FieldDeriveGen { 10 | implicit def fieldDeriveGen[A: DeriveGen]: DeriveGen[Field[A]] = 11 | DeriveGen.instance(FieldGen.fieldFromAttributes(DeriveGen[A])) 12 | } 13 | 14 | object FieldDeriveGen extends FieldDeriveGen 15 | -------------------------------------------------------------------------------- /morphir/contrib/knowledge/src/morphir/kb/logic/core/Field.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic.core 2 | 3 | import scala.reflect.ClassTag 4 | 5 | // TODO: Consider if we want to use izumi.reflect.Tag.Tag instead of ClassTag 6 | final case class Field[A](name: Name, fieldType: ClassTag[A]) 7 | object Field { 8 | def define[A](name: Name)(implicit tpe: ClassTag[A]): Field[A] = Field(name, tpe) 9 | def define[A](implicit name: sourcecode.Name, tpe: ClassTag[A]): Field[A] = Field(name.value, tpe) 10 | } 11 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "morphir-scala", 3 | "private": true, 4 | "workspaces": [ 5 | "examples/morphir-elm-projects/evaluator-tests", 6 | "examples/morphir-elm-projects/defaults-tests", 7 | "examples/morphir-elm-projects/finance", 8 | "examples/morphir-elm-projects/unit-test-framework/*", 9 | "morphir-elm/sdks/morphir-unit-test" 10 | ], 11 | "dependencies": {}, 12 | "scripts": {}, 13 | "resolutions": {}, 14 | "devDependencies": { 15 | "morphir-elm": "^2.89.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/elm/MorphirElmModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.elm 2 | import mill._ 3 | import mill.scalalib._ 4 | import org.finos.millmorphir.MorphirModule 5 | 6 | trait MorphirElmModule extends MorphirModule { 7 | def allSourceFiles: T[Seq[PathRef]] = T { 8 | sources().map(_.path).flatMap(os.walk(_).filter(_.ext == "elm")).map(PathRef(_)) 9 | } 10 | 11 | def morphirProjectSourceFileNames = T { 12 | super.morphirProjectSourceFileNames() ++ Set("elm.json") 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /morphir/interop/borer/test/src/org/finos/morphir/datamodel/codecs/Utils.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel.codecs 2 | 3 | import io.bullet.borer._ 4 | import io.bullet.borer.derivation.MapBasedCodecs._ 5 | import org.finos.morphir._ 6 | import org.finos.morphir.datamodel._ 7 | import org.finos.morphir.datamodel.codecs.MdmCodecs._ 8 | 9 | object Utils { 10 | def testCodec(data: Data): Boolean = { 11 | val bytes = Cbor.encode[Data](data).toByteArray 12 | Cbor.decode(bytes).to[Data].value == data 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/ElmCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | 4 | import zio._ 5 | import zio.Console.printLine 6 | import zio.process.Command 7 | 8 | object ElmCmdlet extends Cmdlet[CliCommand.Elm, Exception] { 9 | def run(args: CliCommand.Elm) = { 10 | val cmd = Command("morphir-elm").inheritIO 11 | for { 12 | _ <- printLine(s"Elm: $args") 13 | res <- cmd.linesStream.runDrain 14 | _ <- printLine(res) 15 | } yield () 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/elm.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "package", 3 | "name": "finos/morphir-test-example-project", 4 | "summary": "Morphir Unit Test Framework Example", 5 | "license": "Apache-2.0", 6 | "version": "1.0.0", 7 | "exposed-modules": [], 8 | "elm-version": "0.19.0 <= v < 0.20.0", 9 | "dependencies": { 10 | "elm/core": "1.0.0 <= v < 2.0.0", 11 | "finos/morphir-elm": "21.0.1 <= v < 22.0.0" 12 | }, 13 | "test-dependencies": {} 14 | } 15 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/ElmProject.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm 2 | import semver.Version 3 | 4 | sealed trait ElmProject extends Product with Serializable 5 | object ElmProject { 6 | final case class Application(sourceDirectories: Vector[String], elmVersion: Version) extends ElmProject 7 | final case class Package() extends ElmProject 8 | } 9 | 10 | final case class AppDependencies(direct: Map[String, Version], indirect: Map[String, Version]) 11 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/semver/Relation.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm.semver 2 | 3 | sealed abstract class Relation(val value: Int) 4 | object Relation { 5 | case object Superset extends Relation(0) 6 | case object Subset extends Relation(1) 7 | case object Overlapping extends Relation(2) 8 | case object Disjoint extends Relation(3) 9 | case object Equal extends Relation(4) 10 | val values: IndexedSeq[Relation] = IndexedSeq(Superset, Subset, Overlapping, Disjoint, Equal) 11 | } 12 | -------------------------------------------------------------------------------- /mill-build/src/org/finos/millmorphir/api/MakeOutputs.scala: -------------------------------------------------------------------------------- 1 | package org.finos.millmorphir.api 2 | 3 | final case class MakeOutputs(moduleId: String, artifacts: Set[ArtifactRef]) { 4 | def addArtifact(artifact: ArtifactRef): MakeOutputs = MakeOutputs(moduleId, artifacts + artifact) 5 | def addArtifacts(artifacts: ArtifactRef*): MakeOutputs = MakeOutputs(moduleId, this.artifacts ++ artifacts) 6 | } 7 | 8 | object MakeOutputs { 9 | implicit val jsonFormatter: upickle.default.ReadWriter[MakeOutputs] = upickle.default.macroRW 10 | } 11 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/BinaryCodec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.codec 2 | 3 | import zio.Chunk 4 | import zio.stream.ZPipeline 5 | 6 | trait BinaryCodec[A] extends Codec[Chunk[Byte], Byte, A] 7 | 8 | object BinaryCodec { 9 | 10 | type BinaryEncoder[A] = Encoder[Chunk[Byte], Byte, A] 11 | 12 | type BinaryDecoder[A] = Decoder[Chunk[Byte], Byte, A] 13 | 14 | type BinaryStreamEncoder[A] = ZPipeline[Any, Nothing, A, Byte] 15 | 16 | type BinaryStreamDecoder[A] = ZPipeline[Any, DecodeError, Byte, A] 17 | 18 | } 19 | -------------------------------------------------------------------------------- /mill-build/build.sc: -------------------------------------------------------------------------------- 1 | import mill._, scalalib._ 2 | 3 | object millbuild extends MillBuildRootModule { 4 | override def scalacOptions = super.scalacOptions() ++ Seq("-feature", "-deprecation", "-unchecked") 5 | override def ivyDeps = super.ivyDeps() ++ Seq( 6 | ivy"dev.zio::zio:2.1.5", 7 | ivy"dev.zio::zio-config:4.0.3", 8 | ivy"dev.zio::zio-config-magnolia:4.0.3", 9 | ivy"dev.zio::zio-config-typesafe:4.0.3", 10 | ivy"dev.zio::zio-config-yaml:4.0.0-RC16", 11 | ivy"dev.zio::zio-config-refined:4.0.3" 12 | ) 13 | } 14 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/Distribution.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | 5 | import ir.Package.{PackageName, Definition => PkgDef, Specification => PkgSpec} 6 | import zio.prelude.* 7 | 8 | object Distribution { 9 | 10 | sealed trait Distribution 11 | object Distribution { 12 | final case class Library(packageName: PackageName) extends Distribution 13 | 14 | type Dependencies = Dependencies.Type 15 | object Dependencies extends Subtype[Map[PackageName, PkgSpec[Unit]]] 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/syntax/NamingSyntax.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.syntax 2 | 3 | import org.finos.morphir.naming._ 4 | 5 | trait NamingSyntax { 6 | def fqn(packageName: String, module: String, localName: String): FQName = FQName.fqn(packageName, module, localName) 7 | def name(name: String): Name = Name.fromString(name) 8 | def pkg(name: String): PackageName = PackageName.fromString(name) 9 | } 10 | 11 | object NamingSyntax extends NamingSyntax 12 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/ElmGenCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | object ElmGenCmdlet extends Cmdlet[CliCommand.Elm.Gen, Exception] { 8 | def run(args: CliCommand.Elm.Gen) = { 9 | val cmd = Command("morphir-elm", "gen").inheritIO 10 | for { 11 | _ <- printLine(s"Elm Gen: $args") 12 | res <- cmd.linesStream.runDrain 13 | _ <- printLine(res) 14 | } yield () 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /morphir/meta/src/org/finos/morphir/meta/meta.scala: -------------------------------------------------------------------------------- 1 | // This file was taken from the shapely project: https://gitlab.com/fommil/shapely 2 | package org.finos.morphir.meta 3 | 4 | import scala.annotation.Annotation 5 | 6 | trait Meta[A] { 7 | def name: String 8 | def annotations: List[Annotation] 9 | 10 | // field* metadata only exists for case classes 11 | def fieldNames: Array[String] 12 | def fieldAnnotations: Array[List[Annotation]] 13 | } 14 | object Meta extends MetaCompat { 15 | def apply[A](implicit A: Meta[A]): Meta[A] = A 16 | } 17 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/internal/StoredValue.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.internal 2 | 3 | import org.finos.morphir.runtime.RTValue 4 | import org.finos.morphir.ir.Value.TypedDefinition 5 | import org.finos.morphir.naming.* 6 | 7 | sealed trait StoredValue 8 | object StoredValue { 9 | case class Eager(value: RTValue) extends StoredValue 10 | case class Lazy( 11 | toEvaluate: TypedDefinition, 12 | parentContext: CallStackFrame, 13 | siblings: Map[Name, TypedDefinition] 14 | ) extends StoredValue 15 | } 16 | -------------------------------------------------------------------------------- /moon.yml: -------------------------------------------------------------------------------- 1 | fileGroups: 2 | scalaSources: 3 | - "morphir/**/*.scala" 4 | scalaBuildSources: 5 | - "build.sc" 6 | - "project/**/*.{scala,sc}" 7 | - "mill-build/**/*.{scala,sc}" 8 | tasks: 9 | scala-format: 10 | command: | 11 | ./mill Alias/run fmt 12 | inputs: 13 | - "@files(scalaSources)" 14 | - "@files(scalaBuildSources)" 15 | scala-lint: 16 | command: | 17 | ./mill Alias/run checkfmt 18 | inputs: 19 | - "@files(scalaSources)" 20 | - "@files(scalaBuildSources)" 21 | tags: 22 | - "scala" 23 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/FQNameInfo.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | import org.finos.morphir.naming.* 3 | final case class FQNameInfo(fqName: FQName, constructorFQName: Option[FQName] = None) { 4 | def hasConstructorFQName: Boolean = constructorFQName.isDefined 5 | } 6 | object FQNameInfo { 7 | def apply(packageName: PackageName, modulePath: ModuleName, localName: Name): FQNameInfo = 8 | FQNameInfo(FQName(packageName, modulePath, localName)) 9 | 10 | def fromFQName(fqName: FQName): FQNameInfo = FQNameInfo(fqName) 11 | } 12 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/lang/elm/semver/Strictness.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.lang.elm.semver 2 | import enumeratum.values._ 3 | import zio.Chunk 4 | import zio.prelude._ 5 | import zio.prelude.newtypes.Prod 6 | 7 | sealed abstract class Strictness(val value: Int) extends Product with Serializable 8 | 9 | object Strictness { 10 | case object Exact extends Strictness(0) 11 | case object Safe extends Strictness(1) 12 | case object Unsafe extends Strictness(2) 13 | 14 | val values: IndexedSeq[Strictness] = IndexedSeq(Exact, Safe, Unsafe) 15 | } 16 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeConstructorArgs.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | import Type.* 4 | import zio.Chunk 5 | 6 | final case class TypeConstructorArgs[+A](args: List[TypeConstructorArg[A]]) extends AnyVal { self => 7 | def map[B](f: A => B): TypeConstructorArgs[B] = TypeConstructorArgs(self.args.map(_.map(f))) 8 | def toList: List[TypeConstructorArg[A]] = args 9 | } 10 | 11 | object TypeConstructorArgs { 12 | implicit def toList[A](args: TypeConstructorArgs[A]): List[TypeConstructorArg[A]] = args.args 13 | } 14 | -------------------------------------------------------------------------------- /morphir/src/morphir/ir/Name.scala: -------------------------------------------------------------------------------- 1 | package morphir.ir 2 | import org.finos.morphir.naming 3 | 4 | object Name { 5 | type Name = naming.Name 6 | 7 | def fromString(str: String): Name = naming.Name.fromString(str) 8 | def toTitleCase(name: Name): String = name.toTitleCase 9 | def toCamelCase(name: Name): String = name.toCamelCase 10 | def toSnakeCase(name: Name): String = name.toSnakeCase 11 | def toHumanWords(name: Name): List[String] = 12 | name.humanize 13 | 14 | // TODO: Fill with the rest of the functions available in the morphir-elm project 15 | } 16 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/sdk/README.md: -------------------------------------------------------------------------------- 1 | # SDK 2 | These are the basic building blocks for building your domain model and business logic. It also serves as a specification for backend developers that describes the minimum set of functionality each backend implementation should support. 3 | 4 | These are scala implementations of the `Morphir.SDK` found in [morphir-elm](https://github.com/finos/morphir-elm/tree/main/src/Morphir/SDK). 5 | 6 | 7 | You can find the current support page here: [Morphir Scala Support](https://morphir.finos.org/docs/scala/morphir-scala-support). 8 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/MorphirTypeTag.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | import org.finos.morphir.universe.ir.RawTypeInfo 4 | import izumi.reflect.Tag 5 | 6 | trait MorphirTypeTag[A] { 7 | type Underyling = A 8 | 9 | def typeInfo(tag: Tag[A]): MorphirType 10 | } 11 | 12 | object MorphirTypeTag { 13 | def apply[A](implicit tag: MorphirTypeTag[A]): MorphirTypeTag[A] = tag 14 | 15 | // def succeed[A](f: => RawTypeInfo): MorphirTypeTag[A] = new MorphirTypeTag[A] { 16 | // override def typeInfo: RawTypeInfo = f 17 | // } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ConstructorsDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.Type.Constructors 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait ConstructorsDeriveGen { 10 | implicit def constructorsDeriveGen[A: DeriveGen]: DeriveGen[Constructors[A]] = 11 | DeriveGen.instance(ConstructorsGen.constructorsFromAttributes(DeriveGen[A])) 12 | } 13 | 14 | object ConstructorsDeriveGen extends ConstructorsDeriveGen 15 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/QualifiedModuleNameDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming.* 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait QualifiedModuleNameDeriveGen { 10 | implicit val qualifiedModuleNameDeriveGen: DeriveGen[QualifiedModuleName] = 11 | DeriveGen.instance(QualifiedModuleNameGen.qualifiedModuleName) 12 | } 13 | 14 | object QualifiedModuleNameDeriveGen extends QualifiedModuleNameDeriveGen 15 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ValueSpecificationDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait ValueSpecificationDeriveGen { 9 | implicit def valueSpecificationDeriveGen[TA: DeriveGen]: DeriveGen[Value.Specification[TA]] = 10 | DeriveGen.instance(ValueSpecificationGen.valueSpecificationFromAttributes(DeriveGen[TA])) 11 | } 12 | 13 | object ValueSpecificationDeriveGen extends ValueSpecificationDeriveGen 14 | -------------------------------------------------------------------------------- /archived/core/test/src/org/finos/morphir/core/types/EncodedStringSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core.types 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.test._ 5 | import org.finos.morphir.core.Strings.EncodedString 6 | 7 | object EncodedStringSpec extends MorphirBaseSpec { 8 | def spec = suite("EncodedString Spec")( 9 | test("It should be possible to create an encoded string") { 10 | val actual = EncodedString("Hello World") 11 | assertTrue(actual.value == "Hello World", actual.toString == "Hello World") 12 | } 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /morphir/tests/test/jvm-native/src/org/finos/morphir/util/vfile/VFileSpecPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | 3 | import zio.test._ 4 | import java.nio.file.Paths 5 | 6 | trait VFileSpecPlatformSpecific { self: VFileSpec.type => 7 | def platformSpecificSuite = suite("PlatformSpecific")( 8 | test("It should be possible to create a file reference") { 9 | val aPath = (Paths.get("testing", "someTestFile.txt")) 10 | val actual = VFile.fileRef(aPath) 11 | assertEquals(actual.path.toString(), aPath.toString) 12 | } 13 | ) 14 | } 15 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ModuleSpecificationDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait ModuleSpecificationDeriveGen { 9 | implicit def moduleSpecificationDeriveGen[TA: DeriveGen]: DeriveGen[Module.Specification[TA]] = 10 | DeriveGen.instance(ModuleSpecificationGen.moduleSpecificationFromAttributes(DeriveGen[TA])) 11 | } 12 | 13 | object ModuleSpecificationDeriveGen extends ModuleSpecificationDeriveGen 14 | -------------------------------------------------------------------------------- /.scalafix.conf: -------------------------------------------------------------------------------- 1 | rules = [ 2 | Disable 3 | DisableSyntax 4 | ExplicitResultTypes 5 | LeakingImplicitClassVal 6 | NoAutoTupling 7 | NoValInForComprehension 8 | OrganizeImports 9 | ProcedureSyntax 10 | RemoveUnused 11 | ] 12 | 13 | Disable { 14 | ifSynthetic = [ 15 | "scala/Option.option2Iterable" 16 | "scala/Predef.any2stringadd" 17 | ] 18 | } 19 | 20 | OrganizeImports { 21 | # Allign with IntelliJ IDEA so that they don't fight each other 22 | groupedImports = Merge 23 | } 24 | 25 | RemoveUnused { 26 | imports = false // handled by OrganizeImports 27 | } 28 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/model/MorphirProject.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.model 2 | 3 | import zio.json._ 4 | 5 | /// Represents the structure of a Morphir project. 6 | final case class MorphirProject( 7 | name: String, 8 | sourceDirectory: String, 9 | exposedModules: Set[String], 10 | localDependencies: Set[String] = Set.empty 11 | ) 12 | 13 | object MorphirProject { 14 | implicit val decoder: JsonDecoder[MorphirProject] = DeriveJsonDecoder.gen[MorphirProject] 15 | implicit val encoder: JsonEncoder[MorphirProject] = DeriveJsonEncoder.gen[MorphirProject] 16 | } 17 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/ir/internal/types.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package internal 4 | import zio.prelude.Subtype 5 | import zio.prelude.SubtypeCustom 6 | 7 | object types: 8 | type NonEmptyString = NonEmptyString.Type 9 | object NonEmptyString extends SubtypeCustom[String]: 10 | import zio.prelude.Assertion._ 11 | 12 | protected def validate(value: String) = 13 | NonEmptyStringValidator.validate(value) 14 | 15 | protected inline def validateInline(inline value: String) = 16 | ${ NonEmptyStringValidator.validateInlineImpl('value) } 17 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeConstructors.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | import org.finos.morphir.naming.* 3 | 4 | import Type.* 5 | import zio.Chunk 6 | 7 | final case class TypeConstructors[+A](byName: Map[Name, TypeConstructor[A]]) { 8 | def map[B](f: A => B): TypeConstructors[B] = TypeConstructors(byName.view.mapValues(_.map(f)).toMap) 9 | @inline def toMap: Map[Name, TypeConstructor[A]] = byName 10 | } 11 | 12 | object TypeConstructors { 13 | implicit def toMap[A](ctors: TypeConstructors[A]): Map[Name, TypeConstructor[A]] = ctors.byName 14 | } 15 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ModuleDefinitionDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait ModuleDefinitionDeriveGen { 9 | implicit def moduleDefinitionDeriveGen[TA: DeriveGen, VA: DeriveGen]: DeriveGen[Module.Definition[TA, VA]] = 10 | DeriveGen.instance(ModuleDefinitionGen.moduleDefinitionFromAttributes(DeriveGen[TA], DeriveGen[VA])) 11 | } 12 | 13 | object ModuleDefinitionDeriveGen extends ModuleDefinitionDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/QNameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.Gen 7 | 8 | trait QNameGen { 9 | final def qName[R](modulePathGen: Gen[R, Path], localNameGen: Gen[R, Name]): Gen[R, QName] = 10 | for { 11 | modulePath <- modulePathGen 12 | localName <- localNameGen 13 | } yield QName(modulePath, localName) 14 | 15 | final val qName: Gen[Any, QName] = qName(PathGen.path, NameGen.name) 16 | } 17 | 18 | object QNameGen extends QNameGen 19 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/ElmMakeCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | object ElmMakeCmdlet extends Cmdlet[CliCommand.Elm.Make, Exception] { 8 | 9 | def run(args: CliCommand.Elm.Make) = { 10 | val cmd = Command("morphir-elm", "make", "-p", args.projectDir.toString).inheritIO 11 | for { 12 | _ <- printLine(s"Elm Make: $args") 13 | res <- cmd.linesStream.runDrain 14 | _ <- printLine(res) 15 | } yield () 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/PackageSpecificationDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait PackageSpecificationDeriveGen { 9 | implicit def packageSpecificationDeriveGen[TA: DeriveGen]: DeriveGen[PackageModule.Specification[TA]] = 10 | DeriveGen.instance(PackageSpecificationGen.packageSpecificationFromAttributes(DeriveGen[TA])) 11 | } 12 | 13 | object PackageSpecificationDeriveGen extends PackageSpecificationDeriveGen 14 | -------------------------------------------------------------------------------- /morphir/tests/test/jvm-native/src/org/finos/morphir/util/vfile/VPathSpecPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.vfile 2 | import zio.test._ 3 | import java.nio.file.Paths 4 | 5 | trait VPathSpecPlatformSpecific { self: VPathSpec.type => 6 | def platformSpecificSuite = suite("PlatformSpecific")( 7 | suite("JVM-Native")( 8 | test("It should be possible to create from a Path") { 9 | val testPath = Paths.get("home", "test", "path") 10 | val actual = VPath(testPath) 11 | assertTrue(actual.toString == testPath.toString) 12 | } 13 | ) 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /.moon/tasks.yml: -------------------------------------------------------------------------------- 1 | $schema: "https://moonrepo.dev/schemas/tasks.json" 2 | tasks: 3 | build: 4 | inputs: [] 5 | deps: 6 | - target: "~:morphir-elm-build" 7 | optional: true 8 | - target: "~:elm-library-build" 9 | optional: true 10 | fmt: 11 | inputs: [] 12 | deps: 13 | - target: "~:elm-format" 14 | optional: true 15 | - target: "~:scala-format" 16 | optional: true 17 | 18 | lint: 19 | inputs: [] 20 | deps: 21 | - target: "~:elm-lint" 22 | optional: true 23 | - target: "~:scala-lint" 24 | optional: true 25 | -------------------------------------------------------------------------------- /morphir/contrib/knowledge/test/src/morphir/knowledge/logic/core/FieldSpec.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic.core 2 | import zio.test._ 3 | 4 | object FieldSpec extends ZIOSpecDefault { 5 | def spec = suite("FieldSpec")( 6 | suite("define") { 7 | test("define is able to get the name from the variable it is being defined on") { 8 | val snoop = Field.define[String] 9 | val marshal = Field.define[Int] 10 | val dre = Field.define[Double] 11 | assertTrue(snoop.name == "snoop", marshal.name == "marshal", dre.name == "dre") 12 | } 13 | } 14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /morphir/runtime/js/src/org/finos/morphir/runtime/service/MorphirRuntimeDriverPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.service 2 | import zio._ 3 | 4 | trait MorphirRuntimeDriverPlatformSpecific { 5 | val live: ULayer[MorphirRuntimeDriver] = ZLayer.succeed(MorphirRuntimeDriverLive) 6 | 7 | object MorphirRuntimeDriverLive extends MorphirRuntimeDriver { 8 | def test(): Task[Unit] = 9 | for { 10 | _ <- Console.printLine("MorphirRuntimeDriver test command executing") 11 | _ <- Console.printLine("MorphirRuntimeDriver test command executed") 12 | } yield () 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /morphir/runtime/jvm/src/org/finos/morphir/runtime/service/MorphirRuntimeDriverPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.service 2 | import zio._ 3 | 4 | trait MorphirRuntimeDriverPlatformSpecific { 5 | val live: ULayer[MorphirRuntimeDriver] = ZLayer.succeed(MorphirRuntimeDriverLive) 6 | 7 | object MorphirRuntimeDriverLive extends MorphirRuntimeDriver { 8 | def test(): Task[Unit] = 9 | for { 10 | _ <- Console.printLine("MorphirRuntimeDriver test command executing") 11 | _ <- Console.printLine("MorphirRuntimeDriver test command executed") 12 | } yield () 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /morphir/runtime/native/src/org/finos/morphir/runtime/service/MorphirRuntimeDriverPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.service 2 | import zio._ 3 | 4 | trait MorphirRuntimeDriverPlatformSpecific { 5 | val live: ULayer[MorphirRuntimeDriver] = ZLayer.succeed(MorphirRuntimeDriverLive) 6 | 7 | object MorphirRuntimeDriverLive extends MorphirRuntimeDriver { 8 | def test(): Task[Unit] = 9 | for { 10 | _ <- Console.printLine("MorphirRuntimeDriver test command executing") 11 | _ <- Console.printLine("MorphirRuntimeDriver test command executed") 12 | } yield () 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/ValueDefinitionDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.Value.Value 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait ValueDefinitionDeriveGen { 10 | implicit def valueDefinitionDeriveGen[TA: DeriveGen, VA: DeriveGen]: DeriveGen[Value.Definition[TA, VA]] = 11 | DeriveGen.instance(ValueDefinitionGen.valueDefinitionFromAttributes(DeriveGen[TA], DeriveGen[VA])) 12 | } 13 | 14 | object ValueDefinitionDeriveGen extends ValueDefinitionDeriveGen 15 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeMapReferenceName.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | import org.finos.morphir.naming._ 4 | import zio.Chunk 5 | import org.finos.morphir.universe.ir.Type.{Unit => UnitType, _} 6 | 7 | final case class TypeMapReferenceName[Attrib](f: FQName => FQName) extends TypeRewritingFolder[Any, Attrib] { 8 | override def referenceCase( 9 | context: Any, 10 | tpe: Type[Attrib], 11 | attributes: Attrib, 12 | typeName: FQName, 13 | typeParams: List[Type[Attrib]] 14 | ): Type[Attrib] = 15 | Reference(attributes, f(typeName), typeParams) 16 | 17 | } 18 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/MorphirIRFileDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait MorphirIRFileDeriveGen { 9 | implicit val morphirIRVersionDeriveGen: DeriveGen[MorphirIRVersion] = 10 | DeriveGen.instance(MorphirIRFileGen.morphirIRVersion) 11 | 12 | implicit val morphirIRFileDeriveGen: DeriveGen[MorphirIRFile] = 13 | DeriveGen.instance(MorphirIRFileGen.morphirIRFile) 14 | } 15 | 16 | object MorphirIRFileDeriveGen extends MorphirIRFileDeriveGen 17 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/FieldGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import org.finos.morphir.ir.Type.Field 7 | import zio.test.Gen 8 | 9 | trait FieldGen { 10 | final def field[R, A](nameGen: Gen[R, Name], dataGen: Gen[R, A]): Gen[R, Field[A]] = for { 11 | name <- nameGen 12 | data <- dataGen 13 | } yield Field(name, data) 14 | 15 | final def fieldFromAttributes[R, A](implicit attributes: Gen[R, A]): Gen[R, Field[A]] = 16 | field(NameGen.name, attributes) 17 | } 18 | 19 | object FieldGen extends FieldGen 20 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/MorphirTag.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | import org.finos.morphir.naming.* 3 | 4 | trait MorphirTag[A] { 5 | def nodeID: NodeID 6 | } 7 | 8 | object MorphirTag { 9 | def apply[A](implicit ev: MorphirTag[A]): MorphirTag[A] = ev 10 | 11 | trait Has[A] { 12 | def getTag: MorphirTag[A] 13 | } 14 | 15 | trait Companion[A] extends MorphirTag[A] with Has[A] { self => 16 | implicit val tagInstance: MorphirTag[A] = self 17 | final override def getTag: MorphirTag[A] = self 18 | 19 | // object hint { 20 | // def unapply(h: Hints): Option[A] = h.get[A] 21 | // } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /archived/lang/src/org/finos/morphir/lang/scaladsl/Syntax.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package lang.scaladsl 3 | 4 | import org.finos.morphir.ir.Package.PackageName 5 | import org.finos.morphir.ir.Module.ModuleName 6 | sealed trait Syntax 7 | object Syntax: 8 | sealed trait Definition extends Syntax 9 | sealed trait Distro extends Syntax 10 | 11 | case class BundleInfo(name: ir.Package.PackageName) 12 | case class Bundle(info: BundleInfo, modules: List[Module]) extends Distro 13 | case class Module(name: ModuleName, body: Map[ir.Name.Name, ir.Module.ModuleDefOrSpec]) extends Definition 14 | end Syntax 15 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/MyBuild.scala: -------------------------------------------------------------------------------- 1 | package millbuild 2 | import mill._ 3 | import mill.define.ExternalModule 4 | import millbuild.settings._ 5 | 6 | object MyBuild extends ExternalModule { 7 | 8 | lazy val cachedBuildSettings = BuildSettings.load() 9 | 10 | def buildSettings = T.input { 11 | BuildSettings.load() 12 | } 13 | 14 | def devMode = T.input { T.env.getOrElse("MORPHIR_SCALA_DEV_MODE", false) == "true" } 15 | 16 | def showBuildSettings() = T.command { 17 | val settings = buildSettings() 18 | pprint.pprintln(settings) 19 | settings 20 | } 21 | 22 | lazy val millDiscover = mill.define.Discover[this.type] 23 | } 24 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/PackageDefinitionDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.PackageModule 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait PackageDefinitionDeriveGen { 10 | implicit def packageDefinitionDeriveGen[TA: DeriveGen, VA: DeriveGen]: DeriveGen[PackageModule.Definition[TA, VA]] = 11 | DeriveGen.instance(PackageDefinitionGen.packageDefinitionFromAttributes(DeriveGen[TA], DeriveGen[VA])) 12 | } 13 | 14 | object PackageDefinitionDeriveGen extends PackageDefinitionDeriveGen 15 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/module/ModuleSpecFor.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.module 2 | 3 | import org.finos.morphir.naming.* 4 | trait ModuleSpecFor[A] { 5 | 6 | def module: QualifiedModuleName 7 | def spec: Specification[Any] 8 | } 9 | 10 | object ModuleSpecFor { 11 | 12 | /** Summon the module specification for the given module/type. */ 13 | def apply[A](implicit specFor: ModuleSpecFor[A]): ModuleSpecFor[A] = specFor 14 | 15 | def make[A](name: QualifiedModuleName)(moduleSpec: Specification[Any]): ModuleSpecFor[A] = 16 | new ModuleSpecFor[A] { 17 | val module = name 18 | val spec = moduleSpec 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/Documented.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | import zio.prelude._ 4 | 5 | final case class Documented[+A](doc: String, value: A) { 6 | def map[B](f: A => B): Documented[B] = Documented(doc, f(value)) 7 | 8 | def flatMap[B](f: A => Documented[B]): Documented[B] = f(value) 9 | 10 | def zip[B](that: Documented[B]): Documented[(A, B)] = Documented(doc, (value, that.value)) 11 | } 12 | 13 | object Documented { 14 | implicit val CovariantDocumented: Covariant[Documented] = new Covariant[Documented] { 15 | def map[A, B](f: A => B): Documented[A] => Documented[B] = _.map(f) 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/Documented.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | import zio.prelude.* 3 | object Documented { 4 | import Documented.Doc 5 | final case class Documented[+A](doc: String, value: A) { 6 | def map[B](f: A => B): Documented[B] = Documented(doc, f(value)) 7 | } 8 | 9 | object Documented { 10 | import org.typelevel.paiges.{Doc => doc, *} 11 | 12 | def fromDoc[A](doc: Doc, value: A, width: Int = 120): Documented[A] = Documented(doc.render(width), value) 13 | 14 | type Doc = doc 15 | object Doc extends Newtype[doc] { 16 | def apply(text: String): Doc = doc.text(text) 17 | } 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /morphir/src-3/org/finos/morphir/functional/Newtype.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.functional 2 | import org.finos.morphir.naming._ 3 | abstract class Newtype[A] extends HasId { self => 4 | opaque type Type = A 5 | def apply(value: A): Type = value 6 | extension (me: Type) def value: A = me 7 | def unapply(instance: Type): Option[A] = Some(instance) 8 | 9 | implicit val asBijection: Bijection[A, Type] = new Newtype.Make[A, Type] { 10 | def to(a: A): Type = self.apply(a) 11 | 12 | def from(t: Type): A = value(t) 13 | } 14 | } 15 | 16 | object Newtype { 17 | private[functional] trait Make[A, B] extends Bijection[A, B] 18 | } 19 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/service/FileIO.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | import zio._ 3 | import java.io.IOException 4 | import org.finos.morphir.util.vfile.VPath 5 | 6 | trait FileIO { 7 | def readFileText(path: VPath): IO[IOException, String] 8 | def readLines(path: VPath): IO[IOException, List[String]] 9 | } 10 | 11 | object FileIO extends FileIOPlatformSpecific { 12 | def readFileText(path: VPath): ZIO[FileIO, IOException, String] = 13 | ZIO.serviceWithZIO[FileIO](_.readFileText(path)) 14 | 15 | def readLines(path: VPath): ZIO[FileIO, IOException, List[String]] = 16 | ZIO.serviceWithZIO[FileIO](_.readLines(path)) 17 | } 18 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/extensibility/MorphirModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.extensibility 2 | import org.finos.morphir.naming._ 3 | import scala.collection.mutable.{IndexedSeq => MutIndexedSeq} 4 | 5 | sealed trait MorphirModule { 6 | def packageName: String 7 | def moduleName: String 8 | } 9 | 10 | abstract class UserModule(val packageName: String, val moduleName: String) extends MorphirModule {} 11 | 12 | sealed abstract class NativeModule(val packageName: String, val moduleName: String) extends MorphirModule {} 13 | 14 | abstract class SdkModule(packageName: String, moduleName: String) 15 | extends NativeModule(packageName, moduleName) {} 16 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/DocumentedGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.testing.generators.WordGen 6 | import zio.test.Gen 7 | 8 | trait DocumentedGen { 9 | final def documented[R, A](stringGen: Gen[R, String], dataGen: Gen[R, A]): Gen[R, Documented[A]] = for { 10 | doc <- stringGen 11 | data <- dataGen 12 | } yield Documented(doc, data) 13 | 14 | final def documentedFromAttributes[R, A](implicit attributes: Gen[R, A]): Gen[R, Documented[A]] = 15 | documented(WordGen.words, attributes) 16 | } 17 | 18 | object DocumentedGen extends DocumentedGen 19 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/cmdlet/ElmDevelopCmdlet.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | package cmdlet 3 | import zio._ 4 | import zio.Console.printLine 5 | import zio.process.Command 6 | 7 | object ElmDevelopCmdlet extends Cmdlet[CliCommand.Elm.Develop, Exception] { 8 | def run(args: CliCommand.Elm.Develop) = { 9 | val cmd = Command("morphir-elm", "develop", "-p", args.port.toString).inheritIO 10 | for { 11 | _ <- printLine(s"Elm Develop: $args") 12 | _ <- printLine(s"Running elm develop on port ${args.port}") 13 | res <- cmd.linesStream.runDrain 14 | _ <- printLine(res) 15 | } yield () 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/Schema.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | sealed trait Schema[A] {} 4 | 5 | object Schema { 6 | val boolean = Primitive(BasicDataType.Boolean) 7 | val byte = Primitive(BasicDataType.Byte) 8 | val decimal = Primitive(BasicDataType.Decimal) 9 | val integer = Primitive(BasicDataType.Integer) 10 | val int16 = Primitive(BasicDataType.Int16) 11 | val int32 = Primitive(BasicDataType.Int32) 12 | val string = Primitive(BasicDataType.String) 13 | val localDate = Primitive(BasicDataType.LocalDate) 14 | 15 | case class Primitive[A](basicDataType: BasicDataType[A]) extends Schema[A] 16 | } 17 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/internal/CallStackFrame.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.internal 2 | 3 | import org.finos.morphir.naming.* 4 | 5 | final case class CallStackFrame( 6 | bindings: Map[Name, StoredValue], 7 | parent: Option[CallStackFrame] 8 | ) { 9 | def get(name: Name): Option[StoredValue] = 10 | (bindings.get(name), parent) match { 11 | case (Some(res), _) => Some(res) 12 | case (None, Some(parentFrame)) => parentFrame.get(name) 13 | case (None, None) => None 14 | } 15 | def push(bindings: Map[Name, StoredValue]): CallStackFrame = 16 | CallStackFrame(bindings, Some(this)) 17 | } 18 | -------------------------------------------------------------------------------- /morphir/tools/js-jvm/src/org/finos/morphir/service/FileIOPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import java.io.IOException 4 | import org.finos.morphir.util.vfile._ 5 | import zio._ 6 | 7 | trait FileIOPlatformSpecific { 8 | val live: ULayer[FileIO] = ZLayer.succeed(FileIOLive) 9 | 10 | object FileIOLive extends FileIO { 11 | 12 | def readFileText(path: VPath): IO[IOException, String] = 13 | ZIO.fail(new IOException(s"FileIOLive::readFileText Not implemented")) 14 | 15 | def readLines(path: VPath): IO[IOException, List[String]] = 16 | ZIO.fail(new IOException(s"FileIOLive::readFileText Not implemented")) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /morphir/tools/native/src/org/finos/morphir/service/FileIOPlatformSpecific.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import java.io.IOException 4 | import org.finos.morphir.util.vfile._ 5 | import zio._ 6 | 7 | trait FileIOPlatformSpecific { 8 | val live: ULayer[FileIO] = ZLayer.succeed(FileIOLive) 9 | 10 | object FileIOLive extends FileIO { 11 | 12 | def readFileText(path: VPath): IO[IOException, String] = 13 | ZIO.fail(new IOException(s"FileIOLive::readFileText Not implemented")) 14 | 15 | def readLines(path: VPath): IO[IOException, List[String]] = 16 | ZIO.fail(new IOException(s"FileIOLive::readFileText Not implemented")) 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/DistributionDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.distribution.Distribution 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait DistributionDeriveGen { 10 | implicit val libraryDeriveGen: DeriveGen[Distribution.Library] = 11 | DeriveGen.instance(DistributionGen.libraryDistribution) 12 | 13 | implicit val distributionDeriveGen: DeriveGen[Distribution] = 14 | DeriveGen.instance(DistributionGen.distribution) 15 | } 16 | 17 | object DistributionDeriveGen extends DistributionDeriveGen 18 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/settings/JvmBuildSettings.scala: -------------------------------------------------------------------------------- 1 | package millbuild.settings 2 | 3 | import zio.{ConfigProvider, Unsafe, Runtime} 4 | import zio.config._ 5 | import zio.config.magnolia.deriveConfig 6 | import zio.config.typesafe._ 7 | import zio.config.yaml._ 8 | import com.typesafe.config.ConfigFactory 9 | import zio.Config 10 | 11 | final case class JvmBuildSettings(enable: Boolean = true) 12 | 13 | object JvmBuildSettings { 14 | val config = deriveConfig[JvmBuildSettings] 15 | lazy val default: JvmBuildSettings = JvmBuildSettings() 16 | 17 | implicit lazy val rw: upickle.default.ReadWriter[JvmBuildSettings] = upickle.default.macroRW 18 | } 19 | -------------------------------------------------------------------------------- /morphir-cli-local-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # 3 | # Coursier script builds and publishes morphir-cli locally and installs it in coursier directory as 'morphir-cli-local' 4 | # 5 | 6 | echo "Running ./mill __.publishLocal" 7 | 8 | # local publishing 9 | command=$(./mill __.publishLocal 2>&1) 10 | echo "$command" 11 | snapshot_version=$(echo "$command" | grep morphir-main | awk '{print $2}' | sed -n 's/.*Artifact([^,]*,[^,]*,\(.*\)).*/\1/p') 12 | echo "Published local version: $snapshot_version" 13 | 14 | cs bootstrap org.finos.morphir:morphir-main_3:${snapshot_version} -M org.finos.morphir.cli.MorphirCliMain -f -o ~/Library/Application\ Support/Coursier/bin/morphir-cli-local 15 | 16 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/AccessControlledDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import zio.test.magnolia.DeriveGen 6 | import zio.test.magnolia.DeriveGen._ 7 | 8 | trait AccessControlledDeriveGen { 9 | implicit def accessControlledDeriveGen[A: DeriveGen]: DeriveGen[AccessControlled[A]] = 10 | DeriveGen.instance(AccessControlledGen.accessControlledFromAttributes(DeriveGen[A])) 11 | 12 | implicit val accessDeriveGen: DeriveGen[AccessControlled.Access] = 13 | DeriveGen.instance(AccessControlledGen.access) 14 | } 15 | 16 | object AccessControlledDeriveGen extends AccessControlledDeriveGen 17 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/Main.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | 4 | import java.nio.file.Paths 5 | import morphir.cli.{CliSetup, CliCommand, MorphirCliBuildInfo} 6 | import zio.Console.printLine 7 | import zio.cli.HelpDoc.Span.text 8 | import zio.cli._ 9 | import zio.Scope 10 | import zio.ZIOAppArgs 11 | import org.finos.morphir.cli.CliCommandRouter 12 | 13 | object Main extends ZIOCliDefault: 14 | override def cliApp = CliApp.make( 15 | name = MorphirCliBuildInfo.product, 16 | version = MorphirCliBuildInfo.version, 17 | summary = text(MorphirCliBuildInfo.description), 18 | command = CliSetup.morphir 19 | )(CliCommandRouter.handleCliCommand(_)) 20 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/unit-test-framework/example-project/src/Example/ExampleModule.elm: -------------------------------------------------------------------------------- 1 | module Example.ExampleModule exposing (..) 2 | 3 | 4 | addOne : Int -> Int 5 | addOne x = 6 | x + 1 7 | 8 | 9 | type Color 10 | = Red 11 | | Blue 12 | | Green 13 | | Yellow 14 | 15 | 16 | stringToColor : String -> Result String Color 17 | stringToColor s = 18 | case s of 19 | "Red" -> 20 | Ok Red 21 | 22 | "Blue" -> 23 | Ok Blue 24 | 25 | "Green" -> 26 | Ok Green 27 | 28 | "Yellow" -> 29 | Ok Yellow 30 | 31 | other -> 32 | Err (other ++ " is not a color I've ever heard of") 33 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/DataEncoder.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | trait DataEncoder[A] { 3 | final def apply(value: A): Data = encode(value) 4 | def encode(value: A): Data 5 | } 6 | 7 | object DataEncoder { 8 | def apply[A](implicit toData: DataEncoder[A]): DataEncoder[A] = toData 9 | 10 | implicit val boolean: DataEncoder[Boolean] = (value: Boolean) => Data.Boolean(value) 11 | 12 | implicit val byte: DataEncoder[Byte] = (value: Byte) => Data.Byte(value) 13 | 14 | implicit val decimal: DataEncoder[BigDecimal] = (value: BigDecimal) => Data.Decimal(value) 15 | 16 | implicit val string: DataEncoder[String] = (value: String) => Data.String(value) 17 | } 18 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeDefinition.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | import org.finos.morphir.naming._ 4 | 5 | sealed trait TypeDefinition[+A] { self => 6 | def map[B](f: A => B): TypeDefinition[B] = self match { 7 | case TypeDefinition.TypeAliasDefinition(_, _) => ??? 8 | case TypeDefinition.CustomTypeDefinition(_, _) => ??? 9 | } 10 | } 11 | 12 | object TypeDefinition { 13 | final case class TypeAliasDefinition[+A](typeParams: Vector[Name], typeExpr: Type[A]) extends TypeDefinition[A] 14 | final case class CustomTypeDefinition[+A](typeParams: Vector[Name], ctors: AccessControlled[TypeConstructors[A]]) 15 | extends TypeDefinition[A] 16 | } 17 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/MorphirExpr.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe 2 | 3 | //TODO: Evaluate if still needed 4 | sealed trait MorphirExpr[+A] extends Product with Serializable 5 | 6 | sealed trait NumericExpr[+A] extends MorphirExpr[A] { 7 | type Number 8 | } 9 | 10 | object modules { 11 | object sdk { 12 | object Basics { 13 | // import org.finos.morphir.universe.sdk.types.Basics.Integer 14 | 15 | final case class Add[A](left: A, right: A) extends NumericExpr[A] { 16 | type Number = A 17 | } 18 | 19 | final case class Subtract[A](left: A, right: A) extends NumericExpr[A] { 20 | type Number = A 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.moon/toolchain.yml: -------------------------------------------------------------------------------- 1 | $schema: "https://moonrepo.dev/schemas/toolchain.json" 2 | 3 | # Configures Bun within the toolchain. 4 | bun: 5 | # The version to use. Must be a semantic version that includes major, minor, and patch. 6 | version: "1.0.35" 7 | 8 | # Version format to use when syncing dependencies within the project's `package.json`. 9 | # dependencyVersionFormat: 'workspace' 10 | 11 | # Support the "one version policy" by only declaring dependencies in the root `package.json`. 12 | # rootPackageOnly: true 13 | 14 | # Sync a project's dependencies as `dependencies` within the project's `package.json`. 15 | syncProjectWorkspaceDependencies: true 16 | 17 | node: 18 | packageManager: bun 19 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/printing/Stringify.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.printing 2 | 3 | trait Stringify[A] { 4 | def apply(value: A): String 5 | } 6 | 7 | object Stringify extends StringifyLow0 { 8 | def apply[A](implicit printer: Stringify[A]): Stringify[A] = printer 9 | 10 | final implicit class StringifyOps[A](val value: A) extends AnyVal { 11 | def stringify(implicit renderer: Stringify[A]): String = renderer(value) 12 | def stringifyLine(implicit renderer: Stringify[A]): String = renderer(value) + System.lineSeparator() 13 | } 14 | } 15 | 16 | private[printing] trait StringifyLow0 { 17 | implicit def defaultStringify[A]: Stringify[A] = value => value.toString 18 | } 19 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/util/attribs/AttributeValueChangingInterceptor.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.attribs 2 | 3 | sealed trait AttributeValueChangingInterceptor[A] extends ((A, A) => A) 4 | object AttributeValueChangingInterceptor { 5 | 6 | def apply[A](f: (A, A) => A): AttributeValueChangingInterceptor[A] = new AttributeValueChangingInterceptor[A] { 7 | override def apply(v1: A, v2: A): A = f(v1, v2) 8 | } 9 | 10 | def KeepNewValue[A]: AttributeValueChangingInterceptor[A] = 11 | AttributeValueChangingInterceptor((_, newValue) => newValue) 12 | 13 | def KeepOldValue[A]: AttributeValueChangingInterceptor[A] = 14 | AttributeValueChangingInterceptor((oldValue, _) => oldValue) 15 | } 16 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/ir/visitors.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | 5 | trait MorphirVisitor[-TA, -VA, -In, +Out] extends upickle.core.Visitor[In, Out] { 6 | def visitName(parts: List[CharSequence], index: Int): Out 7 | } 8 | 9 | trait NameVisitor[-In, +Out] { 10 | def subVisitor: MorphirVisitor[Any, Any, In, Out] 11 | def visitSegment(value: String, index: Int): Unit 12 | def done: Out 13 | } 14 | 15 | trait ValueNodeVisitor[-TA, -VA, -In, +Out] { 16 | import extras.ValueTag 17 | def visitTag(tag: ValueTag, index: Int): Unit 18 | def visitAttributes(index: Int): MorphirVisitor[TA, VA, In, Out] 19 | def visitValue(value: Any, index: Int): Unit 20 | def done: Out 21 | } 22 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/extensibility/SdkModuleDescriptorsSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.extensibility 2 | 3 | import org.finos.morphir.MorphirTag 4 | import org.finos.morphir.naming._ 5 | import org.finos.morphir.testing.MorphirBaseSpec 6 | import zio.test._ 7 | import org.finos.morphir.runtime.NativeSDK.Morphir 8 | 9 | object SdkModuleDescriptorsSpec extends MorphirBaseSpec { 10 | def spec = suite("SdkModuleDescriptorsSpec")( 11 | ) 12 | 13 | def morphirTagSuite = suite("MorphirTag")( 14 | test("MorphirTag should be available for the Basics module via direct summoning")( 15 | assertTrue(MorphirTag[Morphir.SDK.Basics.type] == Morphir.SDK.Basics.morphirTag) 16 | ) 17 | ) 18 | 19 | } 20 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/settings/MillSettings.scala: -------------------------------------------------------------------------------- 1 | package millbuild.settings 2 | 3 | import zio.{ConfigProvider, Unsafe, Runtime} 4 | import zio.config._ 5 | import zio.config.magnolia.deriveConfig 6 | import zio.config.typesafe._ 7 | import zio.Config 8 | 9 | case class MillSettings( 10 | scalaVersion: String = MillSettings.defaultScalaVersion 11 | ) 12 | 13 | object MillSettings { 14 | val config: Config[MillSettings] = deriveConfig[MillSettings] 15 | lazy val default: MillSettings = MillSettings() 16 | lazy val defaultScalaVersion = "2.13.16" 17 | implicit val rw: upickle.default.ReadWriter[MillSettings] = upickle.default.macroRW 18 | } 19 | -------------------------------------------------------------------------------- /morphir/lib/ReadMe.md: -------------------------------------------------------------------------------- 1 | # Morphir/Lib 2 | 3 | This section of the code is intended to contain libraries which can be used within actual code uses the Morphir `msc` compiler plugin. 4 | 5 | ## Supported Libs 6 | 7 | | Name | Status | Description | 8 | | ------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | 9 | | interop | Incubating | Contains annotations and types which the Morphir compiler plugin uses to understand the code it is compiling. | 10 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/source/Location.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.source 2 | import zio.prelude._ 3 | final case class Location(row: Int, column: Int) { 4 | def offsetColumnBy(n: Int): Location = 5 | copy(column = column + n) 6 | 7 | def offsetRowBy(n: Int): Location = 8 | copy(row = row + n) 9 | } 10 | object Location { 11 | val default: Location = Location(0, 0) 12 | val home: Location = Location(0, 0) 13 | 14 | implicit val LocationIdentity: Identity[Location] = new Identity[Location] { 15 | final val identity: Location = home 16 | 17 | override def combine(l: => Location, r: => Location): Location = 18 | Location(row = l.row + r.row, column = l.column + r.column) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /morphir/tests/src/org/finos/morphir/universe/ir/KnownTypes.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | import org.finos.morphir.naming._ 3 | import org.finos.morphir.util.attribs._ 4 | 5 | object KnownTypes { 6 | val int = Type.Reference(Attributes.empty, pkg"Morphir.SDK" % "Basics" % "Int", Nil) 7 | val bool = Type.Reference(Attributes.empty, pkg"Morphir.SDK" % "Basics" % "Bool", Nil) 8 | val float = Type.Reference(Attributes.empty, pkg"Morphir.SDK" % "Basics" % "Float", Nil) 9 | def list(elementType: Type[Attributes]) = 10 | Type.Reference(Attributes.empty, pkg"Morphir.SDK" % "List" % "List", elementType :: Nil) 11 | val string = Type.Reference(Attributes.empty, pkg"Morphir.SDK" % "Basics" % "String", Nil) 12 | } 13 | -------------------------------------------------------------------------------- /morphir/extensibility/src/org/finos/morphir/annotation/qualifiedModuleName.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.annotation 2 | import scala.annotation._ 3 | 4 | /// Annotation used to define th package name for a type or module in Morphir. 5 | /// NOTE: That a package in Morphir is not a synonym for a namespace like it is in Java or Scala, but it represents a unit of distribution 6 | /// like a Nuget, NPM, or Maven package. 7 | final case class packageName(value: String) extends StaticAnnotation 8 | 9 | final case class fullyQualifiedName(packageName: String, moduleName: String, localName: String) extends StaticAnnotation 10 | final case class qualifiedModuleName(packageName: String, moduleName: String) extends StaticAnnotation 11 | -------------------------------------------------------------------------------- /morphir/runtime/test/src/org/finos/morphir/runtime/CallStackSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package runtime 3 | 4 | import org.finos.morphir.testing.MorphirBaseSpec 5 | import zio.test.* 6 | object CallStackSpec extends MorphirBaseSpec { 7 | def spec = suite("CallStack Spec")( 8 | test("An empty CallStack can be created") { 9 | val sut = CallStack.empty 10 | assertTrue(sut.frames.isEmpty) 11 | }, 12 | test("A frame can be pushed onto a CallStack") { 13 | val sut = CallStack.empty 14 | val frame = StackFrame.empty 15 | val initialSize = sut.size 16 | val actual = sut.push(frame) 17 | assertTrue(actual.size == 1, actual.size == actual.depth) 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/CustomDeriver.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | trait CustomDeriver[T] extends Deriver[T] { 4 | def derive(value: T): Data 5 | def concept: Concept 6 | 7 | def contramap[R](f: R => T): CustomDeriver[R] = 8 | CustomDeriver.ofType(b => this.derive(f(b)), this.concept) 9 | 10 | def contramapWithConcept[R](concept0: Concept)(f: R => T): CustomDeriver[R] = 11 | CustomDeriver.ofType(b => this.derive(f(b)), concept0) 12 | } 13 | 14 | object CustomDeriver { 15 | def ofType[A](f: A => Data, concept0: Concept): CustomDeriver[A] = 16 | new CustomDeriver[A] { 17 | override def derive(a: A): Data = f(a) 18 | override def concept: Concept = concept0 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/samples/AttributionExample.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.samples 2 | 3 | import zio.ZEnvironment 4 | import org.finos.morphir.ir.Type.UType 5 | 6 | object AttributionExample { 7 | 8 | sealed trait ValueAttribute 9 | 10 | object ValueAttribute { 11 | 12 | final case class AscribedType(tpe: UType) extends ValueAttribute 13 | // final case class Attribute1(value: File with Closeable) extends Attribute 14 | // final case class Attribute2(value: Int) extends Attribute 15 | 16 | def mapAttributes(environment: ZEnvironment[ValueAttribute])( 17 | f: ValueAttribute => ValueAttribute 18 | ): ZEnvironment[ValueAttribute] = 19 | environment.update(f) 20 | 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /morphir/toolkit/codec/src/org/finos/morphir/mir/file/format/MirFile.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package mir 4 | package file.format 5 | 6 | import org.finos.morphir.ir.Module.QualifiedModuleName 7 | 8 | final case class MirFile(header: MirFileHeader) 9 | object MirFile { 10 | 11 | def apply(moduleName: QualifiedModuleName): MirFile = 12 | MirFile(MirFileHeader(formatVersion = MirFileFormatVersion.latest, moduleName)) 13 | } 14 | final case class MirFileHeader(formatVersion: MirFileFormatVersion, moduleName: QualifiedModuleName) 15 | final case class MirFileFormatVersion(major: Int, minor: Int, revision: Int) 16 | object MirFileFormatVersion { 17 | val latest: MirFileFormatVersion = MirFileFormatVersion(0, 1, 0) 18 | } 19 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🚀 Feature Request 3 | about: I have a suggestion (and may want to implement it 🙂)! 4 | 5 | --- 6 | 7 | ## Feature Request 8 | 9 | ### Description of Problem: 10 | ...what *problem* are you trying to solve that the project doesn't currently solve? 11 | 12 | ...please resist the temptation to describe your request in terms of a solution. Job Story form ("When [triggering condition], I want to [motivation/goal], so I can [outcome].") can help ensure you're expressing a problem statement. 13 | 14 | ### Potential Solutions: 15 | ...clearly and concisely describe what you want to happen. Add any considered drawbacks. 16 | 17 | ... if you've considered alternatives, clearly and concisely describe those too. 18 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/FQNameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.Gen 7 | 8 | trait FQNameGen { 9 | final def fqName[R]( 10 | packagePathGen: Gen[R, Path], 11 | modulePathGen: Gen[R, Path], 12 | localNameGen: Gen[R, Name] 13 | ): Gen[R, FQName] = 14 | for { 15 | packagePath <- packagePathGen 16 | modulePath <- modulePathGen 17 | name <- localNameGen 18 | } yield FQName(PackageName(packagePath), ModuleName(modulePath), name) 19 | 20 | final val fqName: Gen[Any, FQName] = fqName(PathGen.path, PathGen.path, NameGen.name) 21 | } 22 | 23 | object FQNameGen extends FQNameGen 24 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/datamodel/json/zio/ZioJsonSuite.scala: -------------------------------------------------------------------------------- 1 | // package org.finos.morphir.datamodel.json.zio 2 | 3 | // import org.finos.morphir.datamodel._ 4 | // import org.finos.morphir.datamodel.json.zio.codecs._ 5 | // import org.scalacheck.Prop._ 6 | // import zio.json._ 7 | 8 | // class ZioJsonSuite extends munit.ScalaCheckSuite { 9 | 10 | // // checkBasicTypeEncodings() 11 | 12 | // // def checkBasicTypeEncodings()(implicit loc: munit.Location) = 13 | // // BasicDataType.all.foreach { basicType => 14 | // // test(s"BasicDataType ($basicType) should support encoding with zio-json") { 15 | // // val actual = basicType.toJson 16 | // // assert(actual.contains(s"\"$basicType\"")) 17 | // // } 18 | // // } 19 | // } 20 | -------------------------------------------------------------------------------- /coursier-channel.json: -------------------------------------------------------------------------------- 1 | { 2 | "morphir-cli": { 3 | "repositories": [ 4 | "central", 5 | "sonatype:releases", 6 | "typesafe:ivy-releases" 7 | ], 8 | "dependencies": [ 9 | "org.finos.morphir:morphir-main_3:latest.release" 10 | ], 11 | "mainClass": "org.finos.morphir.cli.MorphirCliMain" 12 | }, 13 | "morphir-insiders-cli": { 14 | "repositories": [ 15 | "central", 16 | "sonatype:releases", 17 | "sonatype:snapshots", 18 | "typesafe:ivy-releases" 19 | ], 20 | "dependencies": [ 21 | "org.finos.morphir:morphir-main_3:latest.release" 22 | ], 23 | "maincClass": "org.finos.morphir.cli.MorphirCliMain" 24 | } 25 | } -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/QualifiedModuleNameGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.naming._ 6 | import zio.test.Gen 7 | 8 | trait QualifiedModuleNameGen { 9 | final def qualifiedModuleName[R]( 10 | packageName: Gen[R, PackageName], 11 | moduleName: Gen[R, ModuleName] 12 | ): Gen[R, QualifiedModuleName] = 13 | for { 14 | namespace <- packageName 15 | localName <- moduleName 16 | } yield QualifiedModuleName(namespace, localName) 17 | 18 | final val qualifiedModuleName: Gen[Any, QualifiedModuleName] = 19 | qualifiedModuleName(PackageNameGen.packageName, ModuleNameGen.moduleName) 20 | } 21 | 22 | object QualifiedModuleNameGen extends QualifiedModuleNameGen 23 | -------------------------------------------------------------------------------- /morphir/tests/test/src-3/org/finos/morphir/util/PrinterSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util 2 | 3 | import Printer.given 4 | import zio.test._ 5 | import org.finos.morphir.testing.MorphirBaseSpec 6 | 7 | object PrinterSpec extends MorphirBaseSpec { 8 | def spec = suite("PrinterSpec")( 9 | test("The out the box Orinter with a Simple Renderer should properly print Booleans") { 10 | check(Gen.boolean) { (v: Boolean) => 11 | assertTrue(v.text == Printer.Text.Run(v.toString), v.tprint == v.toString) 12 | } 13 | }, 14 | test("The out the box Printer with a Simple Renderer should properly print a sting") { 15 | check(Gen.alphaNumericString) { (v: String) => 16 | assertTrue(v.text == Printer.Text.Run(v), v.tprint == v) 17 | } 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/SingleEnumWrapper.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | import org.finos.morphir.naming._ 4 | 5 | case class SingleEnumWrapper(label: String, innerShape: Concept, rootPath: QualifiedModuleName) { 6 | def construct(value: Data) = 7 | Data.Case( 8 | EnumLabel.Empty -> value 9 | )(label, this.concept) 10 | 11 | def concept = 12 | Concept.Enum( 13 | rootPath % label, 14 | Concept.Enum.Case(Label(label), EnumLabel.Empty -> innerShape) 15 | ) 16 | } 17 | 18 | case class UnitEnumWrapper(label: String, rootPath: QualifiedModuleName) { 19 | def construct = 20 | Data.Case()(label, this.concept) 21 | 22 | def concept = 23 | Concept.Enum( 24 | rootPath % label, 25 | Concept.Enum.Case(Label(label)) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/settings/ScalaJsBuildSettings.scala: -------------------------------------------------------------------------------- 1 | package millbuild.settings 2 | 3 | import zio.{ConfigProvider, Unsafe, Runtime} 4 | import zio.config._ 5 | import zio.config.magnolia.deriveConfig 6 | import zio.config.typesafe._ 7 | import zio.config.yaml._ 8 | import com.typesafe.config.ConfigFactory 9 | import zio.Config 10 | 11 | final case class ScalaJsBuildSettings(enable: Boolean = true, version: String = ScalaJsBuildSettings.defaultVersion) 12 | 13 | object ScalaJsBuildSettings { 14 | val config = deriveConfig[ScalaJsBuildSettings] 15 | lazy val default: ScalaJsBuildSettings = ScalaJsBuildSettings() 16 | lazy val defaultVersion = "1.16.0" 17 | 18 | implicit lazy val rw: upickle.default.ReadWriter[ScalaJsBuildSettings] = upickle.default.macroRW 19 | } 20 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/datamodel/ToDataOptionalSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.{test => _, _} 5 | import zio.test._ 6 | 7 | object ToDataOptionalSpec extends MorphirBaseSpec { 8 | def spec = suite("ToDataOptionalSpec")( 9 | test("Option") { 10 | assertTrue( 11 | Deriver.toData(Option(123)) == Data.Optional.Some(Data.Int(123)) 12 | ) 13 | }, 14 | test("Option Some") { 15 | assertTrue( 16 | Deriver.toData(Some(123)) == 17 | Data.Optional.Some(Data.Int(123)) 18 | ) 19 | }, 20 | test("Option None") { 21 | assertTrue( 22 | Deriver.toData(None) == 23 | Data.Optional.None(Concept.Nothing) 24 | ) 25 | } 26 | ) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /morphir/ReadMe.md: -------------------------------------------------------------------------------- 1 | # morphir-dataformats 2 | 3 | Provides various dataformats which are provided by Morphir. 4 | 5 | ## Attribution 6 | 7 | The data formats here take some inspiration from Smithy and Amazon's Ion formats, as well as obvious formats like JSON and S-Expressions. 8 | 9 | We make use of some of the concepts found in [Smithy4s](https://disneystreaming.github.io/smithy4s/) in this codebase. Smithy4s is [licensed](https://github.com/disneystreaming/smithy4s/blob/63cf8eba47356bb155bf4354354ab737f0d5718c/LICENSE) under the Tomorrow Open Source Technology License. 10 | 11 | ## TODOs 12 | 13 | - [ ] Rename module to morphir-dataformats 14 | - [ ] Add Concept and Schema[A] 15 | - Concept is similar to Schema but is not a GADT 16 | - Add DynamicValue, AmorphousValue, or FlexValue to represent unconstrained data without schema or Concept -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/util/attribs/AttributeSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util.attribs 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.test._ 5 | 6 | object AttributeSpec extends MorphirBaseSpec { 7 | def spec = suite("AttributeSpec")( 8 | test("Two properties with the same name and type should be the same") { 9 | val propertyA = Attribute("user", "") 10 | val propertyB = Attribute("user", "") 11 | val propertyC = Attribute("user", "N/A") 12 | 13 | assertTrue(propertyA == propertyB, propertyA == propertyC) 14 | }, 15 | test("It should support creating a Binding using the \":=\" operator") { 16 | val property = Attribute("lastName", "Smith") 17 | assertTrue((property := "Jones") == Attribute.Binding(property, "Jones")) 18 | } 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: 🐛 Bug Report 3 | about: If something isn't working as expected 🤔. 4 | 5 | --- 6 | 7 | ## Bug Report 8 | 9 | ### Steps to Reproduce: 10 | 1. ...step 1 description... 11 | 2. ...step 2 description... 12 | 3. ...step 3 description... 13 | 14 | ### Expected Result: 15 | ...description of what you expected to see... 16 | 17 | ### Actual Result: 18 | ...what actually happened, including full exceptions (please include the entire stack trace, including "caused by" entries), log entries, screen shots etc. where appropriate... 19 | 20 | ### Environment: 21 | ...version and build of the project, OS and runtime versions, virtualised environment (if any), etc. ... 22 | 23 | ### Additional Context: 24 | ...add any other context about the problem here. If applicable, add screenshots to help explain... 25 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/sdk/CommonSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir.sdk 2 | 3 | import org.finos.morphir.ir.Type 4 | import org.finos.morphir.naming._ 5 | import org.finos.morphir.ir.Gens 6 | import org.finos.morphir.testing.MorphirBaseSpec 7 | import zio.test._ 8 | 9 | object CommonSpec extends MorphirBaseSpec { 10 | def spec = suite("Common Spec")( 11 | suite("packageName")( 12 | test("should return the expected value") { 13 | assertTrue(Common.packageName.toPath == Path.fromString("Morphir.SDK")) 14 | } 15 | ), 16 | suite("tVar")( 17 | test("should work as expected") { 18 | check(Gens.words) { s => 19 | val actual = Common.tVar(s) 20 | assertTrue( 21 | actual == Type.variable(s) 22 | ) 23 | } 24 | } 25 | ) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/datamodel/BasicDataType.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.datamodel 2 | sealed trait BasicDataType[+A] 3 | 4 | object BasicDataType { 5 | case object Boolean extends BasicDataType[scala.Boolean] 6 | case object Byte extends BasicDataType[Byte] 7 | case object Decimal extends BasicDataType[scala.BigDecimal] 8 | case object Integer extends BasicDataType[scala.BigInt] 9 | case object Int16 extends BasicDataType[Short] 10 | case object Int32 extends BasicDataType[Int] 11 | case object String extends BasicDataType[java.lang.String] 12 | case object LocalDate extends BasicDataType[java.time.LocalDate] 13 | 14 | val all: Set[BasicDataType[Any]] = Set( 15 | Boolean, 16 | Byte, 17 | Decimal, 18 | Integer, 19 | Int16, 20 | Int32, 21 | String, 22 | LocalDate 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ir/packages/PackageModule.scala: -------------------------------------------------------------------------------- 1 | package org.finos 2 | package morphir 3 | package ir 4 | package packages 5 | 6 | trait PackageModule { 7 | 8 | final type Definition[+TA, +VA] = morphir.ir.packages.Definition[TA, VA] 9 | final val Definition: morphir.ir.packages.Definition.type = morphir.ir.packages.Definition 10 | 11 | final type Specification[+TA] = morphir.ir.packages.Specification[TA] 12 | final val Specification: morphir.ir.packages.Specification.type = morphir.ir.packages.Specification 13 | 14 | final type USpecification = morphir.ir.packages.Specification[scala.Unit] 15 | final val USpecification: morphir.ir.packages.Specification.type = morphir.ir.packages.Specification 16 | 17 | val emptySpecification: Specification[Nothing] = Specification.empty 18 | } 19 | 20 | object PackageModule extends PackageModule 21 | -------------------------------------------------------------------------------- /ci/release-maven.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eu 4 | 5 | echo "$SONATYPE_PGP_SECRET" | base64 --decode > gpg_key 6 | 7 | gpg --import --no-tty --batch --yes gpg_key 8 | 9 | rm gpg_key 10 | 11 | # Build all artifacts 12 | ./mill -i __.publishArtifacts 13 | 14 | # Publish all artifacts 15 | ./mill -i \ 16 | mill.scalalib.PublishModule/publishAll \ 17 | --sonatypeCreds "$SONATYPE_DEPLOY_USER":"$SONATYPE_DEPLOY_PASSWORD" \ 18 | --gpgArgs --passphrase="$SONATYPE_PGP_PASSWORD",--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b \ 19 | --publishArtifacts __.publishArtifacts \ 20 | --readTimeout 3600000 \ 21 | --awaitTimeout 3600000 \ 22 | --release true \ 23 | --signed true \ 24 | --sonatypeUri https://s01.oss.sonatype.org/service/local \ 25 | --sonatypeSnapshotUri https://s01.oss.sonatype.org/content/repositories/snapshots 26 | -------------------------------------------------------------------------------- /morphir/contrib/knowledge/src/morphir/kb/logic/converter/ConstraintConverter.scala: -------------------------------------------------------------------------------- 1 | package morphir.knowledge.logic.converter 2 | import morphir.knowledge.logic.model.ConstraintModel 3 | import morphir.knowledge.logic.core.Goal 4 | 5 | private[knowledge] trait ConstraintConverter { 6 | def convertToGoal(constraintModel: ConstraintModel): Goal 7 | } 8 | 9 | private[knowledge] object ConstraintConverter { 10 | sealed abstract class ConstraintCombinatorType extends Product with Serializable 11 | 12 | object ConstraintCombinatorType { 13 | case object None extends ConstraintCombinatorType 14 | case object And extends ConstraintCombinatorType 15 | case object Or extends ConstraintCombinatorType 16 | } 17 | 18 | object Default extends ConstraintConverter { 19 | def convertToGoal(constraintModel: ConstraintModel): Goal = 20 | ??? 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /morphir/tools/src/org/finos/morphir/service/MorphirSetup.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.service 2 | 3 | import org.finos.morphir.util.vfile._ 4 | import zio._ 5 | 6 | trait MorphirSetup { 7 | def setup(morphirHomeDir: VPath): zio.Task[Unit] 8 | } 9 | 10 | object MorphirSetup { 11 | val live: ULayer[MorphirSetup] = ZLayer.succeed(MorphirSetupLive) 12 | 13 | object MorphirSetupLive extends MorphirSetup { 14 | def setup(morphirHomeDir: VPath): zio.Task[Unit] = 15 | for { 16 | _ <- Console.printLine("Setup command executing") 17 | _ <- Console.printLine(s"\tmorphirHomeDir: $morphirHomeDir") 18 | _ <- Console.printLine("Setup command executed") 19 | } yield () 20 | } 21 | 22 | def setup(morphirHomeDir: VPath): zio.ZIO[MorphirSetup, Throwable, Unit] = 23 | ZIO.serviceWithZIO[MorphirSetup](_.setup(morphirHomeDir)) 24 | } 25 | -------------------------------------------------------------------------------- /examples/morphir-elm-projects/finance/src/elm/Morphir/Examples/Accounting/TAccount.elm: -------------------------------------------------------------------------------- 1 | module Morphir.Examples.Accounting.TAccount exposing (..) 2 | 3 | 4 | type alias Amount = 5 | Int 6 | 7 | 8 | type alias AccountName = 9 | String 10 | 11 | 12 | type alias TAccount = 13 | { name : AccountName 14 | , balance : Amount 15 | , debits : List Amount 16 | , credits : List Amount 17 | } 18 | 19 | 20 | make : AccountName -> Amount -> TAccount 21 | make name balance = 22 | { name = name 23 | , balance = balance 24 | , debits = [] 25 | , credits = [] 26 | } 27 | 28 | 29 | entry : TAccount -> TAccount -> Amount -> ( TAccount, TAccount ) 30 | entry debitAccount creditAccount amount = 31 | ( { debitAccount | debits = amount :: debitAccount.debits } 32 | , { creditAccount | credits = amount :: creditAccount.credits } 33 | ) 34 | -------------------------------------------------------------------------------- /mill-build/src/millbuild/settings/ScalaNativeBuildSettings.scala: -------------------------------------------------------------------------------- 1 | package millbuild.settings 2 | 3 | import zio.{ConfigProvider, Unsafe, Runtime} 4 | import zio.config._ 5 | import zio.config.magnolia.deriveConfig 6 | import zio.config.typesafe._ 7 | import zio.config.yaml._ 8 | import com.typesafe.config.ConfigFactory 9 | import zio.Config 10 | 11 | final case class ScalaNativeBuildSettings( 12 | enable: Boolean = false, 13 | version: String = ScalaNativeBuildSettings.defaultVersion 14 | ) 15 | 16 | object ScalaNativeBuildSettings { 17 | val config: Config[ScalaNativeBuildSettings] = deriveConfig[ScalaNativeBuildSettings] 18 | lazy val default: ScalaNativeBuildSettings = ScalaNativeBuildSettings() 19 | 20 | lazy val defaultVersion = "0.4.17" 21 | 22 | implicit lazy val rw: upickle.default.ReadWriter[ScalaNativeBuildSettings] = upickle.default.macroRW 23 | } 24 | -------------------------------------------------------------------------------- /morphir/main/src/org/finos/morphir/cli/MorphirCommand.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | import zio._ 3 | import java.nio.file.Path 4 | 5 | enum MorphirCommand { 6 | case Bundle(outputPath: Path, irFiles: List[Path]) 7 | case Develop(port: Int, host: String, projectDir: Path, openInBrowser: Boolean) 8 | case Library(outputDir: Path, irFiles: List[Path]) 9 | case Setup(morphirHomeDir: Path) 10 | case Test(irFiles: List[Path]) 11 | case ElmDevelop(port: Int, host: String, projectDir: Path, openInBrowser: Boolean) 12 | case ElmInit(morphirHomeDir: Path, projectDir: Path) 13 | case ElmMake( 14 | projectDir: Path, 15 | output: Path, 16 | typesOnly: Boolean, 17 | fallbackCli: Boolean = false, 18 | indentJson: Boolean = false 19 | ) 20 | case ElmRestore(elmHome: Path, projectDir: Path) 21 | case ElmTest(projectDir: Path) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/ModuleSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.ir 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.test.* 5 | 6 | object ModuleSpec extends MorphirBaseSpec { 7 | def spec = suite("Module Spec")( 8 | suite("Definition")( 9 | test("It can be empty") { 10 | assertTrue( 11 | Module.emptyDefinition == Module.Definition.empty, 12 | Module.emptyDefinition.types.isEmpty, 13 | Module.emptyDefinition.values.isEmpty 14 | ) 15 | } 16 | ), 17 | suite("Specification")( 18 | test("It can be empty") { 19 | assertTrue( 20 | Module.emptySpecification == Module.Specification.empty, 21 | Module.emptySpecification.types.isEmpty, 22 | Module.emptySpecification.values.isEmpty 23 | ) 24 | } 25 | ) 26 | ) 27 | } 28 | -------------------------------------------------------------------------------- /morphir/tools/cli/src/org/finos/morphir/cli/CliCommandRouter.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.cli 2 | import zio._ 3 | import zio.Console.printLine 4 | import zio.process.Command 5 | import cmdlet._ 6 | object CliCommandRouter { 7 | 8 | def handleCliCommand(cmd: CliCommand): ZIO[ZIOAppArgs, Exception, Any] = 9 | (cmd match { 10 | case cmd: CliCommand.Elm.Develop => ElmDevelopCmdlet.run(cmd) 11 | case cmd: CliCommand.Elm.Make => ElmMakeCmdlet.run(cmd) 12 | case cmd: CliCommand.Elm.Gen => ElmGenCmdlet.run(cmd) 13 | case cmd: CliCommand.Elm => ElmCmdlet.run(cmd) 14 | case cmd: CliCommand.Init => InitCmdlet.run(cmd) 15 | case cmd: CliCommand.Setup => SetupCmdlet.run(cmd) 16 | case cmd: CliCommand.Workspace => WorkspaceCmdlet.run(cmd) 17 | case cmd: CliCommand.About.type => AboutCmdlet.run(cmd) 18 | }) 19 | } 20 | -------------------------------------------------------------------------------- /morphir/tools/launcher/src/org/finos/morphir/launcher/Coursier.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.launcher 2 | 3 | import coursier.cache.FileCache 4 | import coursier.cache.loggers.RefreshLogger 5 | import coursier.util.Task 6 | import coursier.{Dependency, Fetch} 7 | 8 | /** 9 | * Wrapper for Coursier Fetch to facilitate logging progress to stderr and testing. 10 | */ 11 | trait Coursier { 12 | def fetch(deps: Dependency*): Unit 13 | } 14 | 15 | // Avoid using, for instance, ZIO, for module implementation to keep dependencies minimal. 16 | case object CoursierLive extends Coursier { 17 | private def loggingFetch = { 18 | val logger = RefreshLogger.create() 19 | val cacheWithLogger = FileCache[Task]().withLogger(logger) 20 | Fetch().withCache(cacheWithLogger) 21 | } 22 | 23 | def fetch(deps: Dependency*): Unit = loggingFetch.withDependencies(deps).run() 24 | } 25 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/MorphirIRFileJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import zio.test._ 9 | import zio.json.golden.GoldenConfiguration 10 | import zio.test.magnolia.DeriveGen 11 | 12 | object MorphirIRFileJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 13 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 14 | GoldenConfiguration.default.copy( 15 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 16 | sampleSize = 10 17 | ) 18 | def spec = suite("MorphirIRFileJsonCodecProviderSpec")( 19 | goldenTest(DeriveGen[MorphirIRFile]) 20 | ) 21 | } 22 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/NameJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object NameJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("NameJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[Name]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/PathJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.json.golden.GoldenConfiguration 10 | import zio.test._ 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object PathJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("PathJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[Path]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/ModuleDescriptor.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | 3 | import org.finos.morphir.naming._ 4 | import org.finos.morphir.MorphirTag 5 | 6 | trait ModuleDescriptor { self => 7 | type Type = self.type 8 | 9 | final def getTag: MorphirTag[Type] = morphirTag 10 | 11 | implicit lazy val nodeID: NodeID = NodeID.ModuleID.fromQualifiedName(qualifiedModuleName) 12 | implicit def qualifiedModuleName: QualifiedModuleName 13 | 14 | final implicit def morphirTag: MorphirTag[Type] = new MorphirTag[Type] { 15 | override def nodeID: NodeID = NodeID.fromQualifiedName(qualifiedModuleName) 16 | } 17 | 18 | final implicit def hasShapeTag: MorphirTag.Has[Type] = new MorphirTag.Has[Type] { 19 | override def getTag: MorphirTag[Type] = self.getTag 20 | } 21 | } 22 | 23 | object ModuleDescriptor { 24 | type For[A] = ModuleDescriptor { type Type = A } 25 | } 26 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/QNameJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object QNameJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("QNameJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[QName]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/MorphirIRFileGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.distribution.Distribution 6 | import zio.test.Gen 7 | 8 | trait MorphirIRFileGen { 9 | final val morphirIRVersion: Gen[Any, MorphirIRVersion] = 10 | Gen.elements( 11 | MorphirIRVersion.Default 12 | ) 13 | 14 | final def morphirIRFile( 15 | versionGen: Gen[Any, MorphirIRVersion], 16 | distributionGen: Gen[Any, Distribution] 17 | ): Gen[Any, MorphirIRFile] = for { 18 | version <- versionGen 19 | distribution <- distributionGen 20 | } yield MorphirIRFile(version, distribution) 21 | 22 | final val morphirIRFile: Gen[Any, MorphirIRFile] = 23 | morphirIRFile(morphirIRVersion, DistributionGen.distribution) 24 | } 25 | 26 | object MorphirIRFileGen extends MorphirIRFileGen 27 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/FQNameJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object FQNameJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("FQNameJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[FQName]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name-template: 'v$RESOLVED_VERSION' 2 | tag-template: 'v$RESOLVED_VERSION' 3 | template: | 4 | # What's Changed 5 | $CHANGES 6 | categories: 7 | - title: 'Breaking' 8 | label: 'type: breaking' 9 | - title: 'New' 10 | label: 'type: feature' 11 | - title: 'Bug Fixes' 12 | label: 'type: bug' 13 | - title: 'Maintenance' 14 | label: 'type: maintenance' 15 | - title: 'Documentation' 16 | label: 'type: docs' 17 | - title: 'Dependency Updates' 18 | label: 'type: dependencies' 19 | 20 | version-resolver: 21 | major: 22 | labels: 23 | - 'type: breaking' 24 | minor: 25 | labels: 26 | - 'type: feature' 27 | patch: 28 | labels: 29 | - 'type: bug' 30 | - 'type: maintenance' 31 | - 'type: docs' 32 | - 'type: dependencies' 33 | - 'type: security' 34 | 35 | exclude-labels: 36 | - 'skip-changelog' 37 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: 2 | file: .gitpod.Dockerfile 3 | 4 | github: 5 | prebuilds: 6 | # enable for the default branch (defaults to true) 7 | master: true 8 | # enable for all branches in this repo (defaults to false) 9 | branches: false 10 | # enable for pull requests coming from this repo (defaults to true) 11 | pullRequests: true 12 | # enable for pull requests coming from forks (defaults to false) 13 | pullRequestsFromForks: false 14 | # add a check to pull requests (defaults to true) 15 | addCheck: true 16 | # add a "Review in Gitpod" button as a comment to pull requests (defaults to false) 17 | addComment: true 18 | # add a "Review in Gitpod" button to the pull request's description (defaults to false) 19 | addBadge: false 20 | 21 | tasks: 22 | - init: | 23 | ./mill __.compile 24 | 25 | vscode: 26 | extensions: 27 | - scalameta.metals -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/sdk/KeySDK.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.sdk 2 | 3 | import org.finos.morphir.ir.Type 4 | import org.finos.morphir.runtime.MorphirRuntimeError.{FailedCoercion, IllegalValue} 5 | import org.finos.morphir.runtime.{RTValue as RT, *} 6 | import org.finos.morphir.runtime.RTValue.Comparable.orderToInt 7 | import org.finos.morphir.runtime.RTValue.{ 8 | Primitive, 9 | coerceBoolean, 10 | coerceComparable, 11 | coerceDecimal, 12 | coerceFloat, 13 | coerceInt, 14 | coerceList, 15 | coerceNumeric, 16 | coerceTuple, 17 | unwrapNumericWithHelper 18 | } 19 | import org.finos.morphir.runtime.internal.* 20 | import org.finos.morphir.{MInt, MValue} 21 | 22 | import scala.collection.mutable 23 | 24 | object KeySDK { 25 | 26 | val key0 = DynamicNativeFunction1("key0") { 27 | (context: NativeContext) => (a: RT) => 28 | RT.Key0 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /.github/workflows/github-dependency-graph.yml: -------------------------------------------------------------------------------- 1 | name: dependency-graph 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | submit-dependency-graph: 10 | if: github.repository == 'finos/morphir-scala' && github.ref == 'refs/heads/main' 11 | runs-on: ubuntu-latest 12 | steps: 13 | 14 | - uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 17 | 18 | - uses: coursier/cache-action@v6 19 | 20 | - uses: actions/setup-java@v4 21 | with: 22 | distribution: 'temurin' 23 | java-version: '17' 24 | 25 | # We want to see the transmitted graph in the logs 26 | - run: ./mill --import ivy:io.chris-kipp::mill-github-dependency-graph::0.2.5 showNamed io.kipp.mill.github.dependency.graph.Graph/generate 27 | 28 | # Actually upload the graph 29 | - uses: ckipp01/mill-dependency-submission@v1 30 | -------------------------------------------------------------------------------- /.moon/tasks/tag-morphir-elm.yml: -------------------------------------------------------------------------------- 1 | fileGroups: 2 | morphirProjectFiles: 3 | - "morphir.json" 4 | morphirElmSources: 5 | - "src/**/*.elm" 6 | morphirElmArtifacts: 7 | - "morphir-hashes.json" 8 | - "morphir-ir.json" 9 | 10 | tasks: 11 | morphir-elm-build: 12 | deps: 13 | - "~:morphir-elm-make" 14 | 15 | morphir-elm-rebuild: 16 | deps: 17 | - "~:morphir-elm-clean" 18 | - "~:morphir-elm-build" 19 | 20 | morphir-elm-clean: 21 | command: | 22 | rm -rf @files(morphirElmArtifacts) 23 | inputs: 24 | - "@files(morphirElmArtifacts)" 25 | 26 | morphir-elm-make: 27 | command: | 28 | morphir make 29 | inputs: 30 | - "@files(morphirProjectFiles)" 31 | - "@files(morphirElmArtifacts)" 32 | - "package.json" 33 | - "@files(morphirElmSources)" 34 | outputs: 35 | - "morphir-hashes.json" 36 | - "morphir-ir.json" 37 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/LiteralJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.ir.Literal.Literal 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object LiteralJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("LiteralJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[Literal]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/ModuleNameJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object ModuleNameJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("ModulePathJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[ModuleName]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/runtime/services/kernel/Kernel.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.runtime.services.kernel 2 | 3 | import org.finos.morphir.naming.* 4 | import org.finos.morphir.runtime.* 5 | import org.finos.morphir.runtime.exports.* 6 | import zio.prelude.fx.ZPure 7 | import org.finos.morphir.runtime.MorphirRuntimeError.VariableAccessError 8 | 9 | trait Kernel { 10 | type VariableRef = Any // TODO: Replace with appropriate type 11 | def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] 12 | } 13 | 14 | object Kernel { 15 | val live: Kernel = KernelLive() 16 | 17 | def accessVariable(name: Name): RTAction[Kernel, VariableAccessError, Any] = 18 | RTAction.serviceWith(_.accessVariable(name)) 19 | 20 | } 21 | 22 | final case class KernelLive() extends Kernel { 23 | 24 | def accessVariable(name: Name): RTAction[Any, VariableAccessError, VariableRef] = ??? 25 | 26 | } 27 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/AccessControlledGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.AccessControlled 6 | import zio.test.Gen 7 | 8 | trait AccessControlledGen { 9 | final val access: Gen[Any, AccessControlled.Access] = 10 | Gen.elements(AccessControlled.Access.Private, AccessControlled.Access.Public) 11 | 12 | final def accessControlled[R, A]( 13 | accessGen: Gen[R, AccessControlled.Access], 14 | valueGen: Gen[R, A] 15 | ): Gen[R, AccessControlled[A]] = for { 16 | access <- accessGen 17 | value <- valueGen 18 | } yield AccessControlled(access, value) 19 | 20 | final def accessControlledFromAttributes[R, A](implicit valueGen: Gen[R, A]): Gen[R, AccessControlled[A]] = 21 | accessControlled(access, valueGen) 22 | } 23 | 24 | object AccessControlledGen extends AccessControlledGen 25 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/PackageNameJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.naming._ 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object PackageNameJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("PackageNameJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[PackageName]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/FieldSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | 4 | import org.finos.morphir.ir.StringOps 5 | import org.finos.morphir.ir.Type.Field 6 | import org.finos.morphir.testing.MorphirBaseSpec 7 | import zio.test._ 8 | 9 | object FieldSpec extends MorphirBaseSpec { 10 | def spec = suite("Field Spec")( 11 | suite("Field Construction")( 12 | test("A Field can be created from a string and TypeExpr using <:>") { 13 | val actual = "name" <:> Type.variable("String") 14 | assertTrue( 15 | actual == Field("name", Type.variable("String")) 16 | ) 17 | }, 18 | test("A Field can be created from a string and a Type using as") { 19 | val actual = "name" <:> Type.variable("String") 20 | assertTrue( 21 | actual == Field("name", Type.variable("String")) 22 | ) 23 | } 24 | ) 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /morphir/tools/launcher/test/src/org/finos/morphir/launcher/MainSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.launcher 2 | import scala.language.reflectiveCalls 3 | import coursier.{Dependency, Module, ModuleName, Organization} 4 | import zio.test._ 5 | 6 | object CoursierSpec extends ZIOSpecDefault { 7 | 8 | def fixture = new { 9 | val morphirVersion = MorphirVersionTest("dummyVersion", None, None) 10 | val coursier = CoursierTest() 11 | val main = Main(morphirVersion, coursier) 12 | } 13 | 14 | def spec = suite("Launcher")( 15 | test("should fetch morphir cli") { 16 | val f = fixture 17 | val expectedMorphirCliDep = Dependency( 18 | Module(Organization("org.finos.morphir"), ModuleName("morphir-tools-cli_3")), 19 | "dummyVersion" 20 | ) 21 | f.main.run() 22 | assertTrue(f.coursier.fetched.contains(expectedMorphirCliDep)) 23 | } 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/util/ScopedVarSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.util 2 | 3 | import org.finos.morphir.testing.MorphirBaseSpec 4 | import zio.test._ 5 | import zio.test.Assertion._ 6 | object ScopedVarSpec extends MorphirBaseSpec { 7 | def spec = suite("ScopedVarSpec")( 8 | test("ScopedVars can be assigned to and retrieved within a scope") { 9 | val flag = new ScopedVar[Boolean] 10 | val total = new ScopedVar[Long] 11 | val (flagValue, totalValue) = ScopedVar.scoped( 12 | flag := true, 13 | total := 999 14 | ) { 15 | (flag.get, total.get) 16 | } 17 | assertTrue(flagValue == true, totalValue == 999L) 18 | }, 19 | test("When unitialized, 'get' throws a ScopedVar.Unitialized exception") { 20 | val notInitialized = new ScopedVar[String] 21 | assert(notInitialized.get)(throwsA[ScopedVar.Unitialized]) 22 | } 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/DocumentedJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 8 | import org.finos.morphir.ir.Literal.Literal 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object DocumentedJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 20 18 | ) 19 | def spec = suite("DocumentedJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[Documented[Literal]]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /archived/core/src/org/finos/morphir/core/Strings.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.core 2 | import zio.prelude.* 3 | 4 | object Strings { 5 | type EncodedString = EncodedString.Type 6 | object EncodedString extends Newtype[String] { 7 | def encode(input: CharSequence)(implicit encoder: StringEncoder): EncodedString = 8 | EncodedString(encoder.encode(input)) 9 | 10 | def encodeWith(encoder: CharSequence => String)(input: CharSequence): EncodedString = 11 | EncodedString(encoder(input)) 12 | 13 | def unapply(input: CharSequence): Option[String] = 14 | input match { 15 | case EncodedString(s) => Option(s) 16 | case _ => None 17 | } 18 | 19 | implicit class EncodedStringOps(val self: EncodedString) extends AnyVal { 20 | def value: String = unwrap(self) 21 | } 22 | } 23 | trait StringEncoder { 24 | def encode(input: CharSequence): String 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /morphir/testing/generators/src/org/finos/morphir/ir/generator/MorphirIRGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | trait MorphirIRGen 6 | extends AccessControlledGen 7 | with ConstructorsGen 8 | with DistributionGen 9 | with DocumentedGen 10 | with FieldGen 11 | with FQNameGen 12 | with LiteralGen 13 | with ModuleDefinitionGen 14 | with QualifiedModuleNameGen 15 | with ModuleNameGen 16 | with ModuleSpecificationGen 17 | with MorphirIRFileGen 18 | with NameGen 19 | with PackageDefinitionGen 20 | with PackageNameGen 21 | with PackageSpecificationGen 22 | with PathGen 23 | with PatternGen 24 | with QNameGen 25 | with TypeDefinitionGen 26 | with TypeGen 27 | with TypeSpecificationGen 28 | with ValueDefinitionGen 29 | with ValueGen 30 | with ValueSpecificationGen 31 | 32 | object MorphirIRGen extends MorphirIRGen 33 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/DistributionJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.distribution.Distribution 8 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 9 | import zio.test._ 10 | import zio.json.golden.GoldenConfiguration 11 | import zio.test.magnolia.DeriveGen 12 | 13 | object DistributionJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 14 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 15 | GoldenConfiguration.default.copy( 16 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 17 | sampleSize = 10 18 | ) 19 | def spec = suite("DistributionJsonCodecProviderSpec")( 20 | goldenTest(DeriveGen[Distribution]) 21 | ) 22 | } 23 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/universe/ir/TypeInfo.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.universe.ir 2 | 3 | sealed trait TypeInfo[+A] { self => 4 | def map[B](f: A => B): TypeInfo[B] = self match { 5 | case TypeInfo.TypeExpr(info) => TypeInfo.TypeExpr(info.map(f)) 6 | case TypeInfo.TypeSpec(info) => TypeInfo.TypeSpec(info.map(f)) 7 | case TypeInfo.TypeDef(info) => TypeInfo.TypeDef(info.map(f)) 8 | } 9 | } 10 | 11 | object TypeInfo { 12 | 13 | def typeExpr[A](value: Type[A]): TypeInfo[A] = TypeExpr(value) 14 | def typeSpec[A](value: TypeSpecification[A]): TypeInfo[A] = TypeSpec(value) 15 | def typeDef[A](value: TypeDefinition[A]): TypeInfo[A] = TypeDef(value) 16 | 17 | final case class TypeExpr[+A](info: Type[A]) extends TypeInfo[A] 18 | final case class TypeSpec[+A](info: TypeSpecification[A]) extends TypeInfo[A] 19 | final case class TypeDef[+A](info: TypeDefinition[A]) extends TypeInfo[A] 20 | } 21 | -------------------------------------------------------------------------------- /morphir/interop/zio/json/test/src/org/finos/morphir/ir/json/codec/FieldJsonCodecProviderSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package json 4 | package codec 5 | 6 | import java.io.File 7 | import org.finos.morphir.ir.Literal.Literal 8 | import org.finos.morphir.ir.Type.Field 9 | import org.finos.morphir.ir.generator.MorphirIRDeriveGen 10 | import zio.test._ 11 | import zio.json.golden.GoldenConfiguration 12 | import zio.test.magnolia.DeriveGen 13 | 14 | object FieldJsonCodecProviderSpec extends MorphirJsonBaseSpec with MorphirIRDeriveGen with MorphirJsonSupport { 15 | implicit lazy val givenGoldenConfiguration: GoldenConfiguration = 16 | GoldenConfiguration.default.copy( 17 | relativePath = implicitly[sourcecode.FullName].value.split('.').dropRight(1).mkString(File.separator), 18 | sampleSize = 20 19 | ) 20 | def spec = suite("FieldJsonCodecProviderSpec")( 21 | goldenTest(DeriveGen[Field[Literal]]) 22 | ) 23 | } 24 | -------------------------------------------------------------------------------- /morphir/runtime/src/org/finos/morphir/runtime/Runtime.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package runtime 3 | 4 | import org.finos.morphir.naming._ 5 | trait Runtime { self => 6 | import Runtime._ 7 | 8 | type TypeAttribs 9 | type ValueAttribs 10 | 11 | final type Environment = EvaluationEnvironment[TypeAttribs, ValueAttribs] 12 | final val Environment: EvaluationEnvironment.type = EvaluationEnvironment 13 | final def makeEnvironment(): Environment = Environment() 14 | 15 | abstract class StatefulTreeWalker[State, +A](initialState: State) { 16 | private var state: State = initialState 17 | 18 | def getState: State = state 19 | def setState(newState: State): Unit = 20 | state = newState 21 | def visitUnit(attributes: ValueAttribs): A 22 | def visitVariable(attributes: ValueAttribs, name: Name): A 23 | } 24 | 25 | } 26 | 27 | object Runtime { 28 | final case class EvaluationEnvironment[+TA, +VA]() 29 | } 30 | -------------------------------------------------------------------------------- /morphir/src/org/finos/morphir/codec/DecodeError.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir.codec 2 | 3 | import zio.Cause 4 | 5 | import scala.util.control.NoStackTrace 6 | 7 | sealed trait DecodeError extends Exception with NoStackTrace { self => 8 | def message: String 9 | override def getMessage: String = message 10 | 11 | def and(that: DecodeError): DecodeError = DecodeError.And(self, that) 12 | 13 | def or(that: DecodeError): DecodeError = DecodeError.Or(self, that) 14 | } 15 | 16 | object DecodeError { 17 | final case class And(left: DecodeError, right: DecodeError) extends DecodeError { 18 | override def message: String = s"${left.message} and ${right.message}" 19 | } 20 | 21 | final case class Or(left: DecodeError, right: DecodeError) extends DecodeError { 22 | override def message: String = s"${left.message} or ${right.message}" 23 | } 24 | 25 | final case class ReadError(cause: Cause[Any], message: String) extends DecodeError 26 | } 27 | -------------------------------------------------------------------------------- /morphir/testing/generators/js-jvm/src/org/finos/morphir/ir/generator/TypeDefinitionDeriveGen.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package generator 4 | 5 | import org.finos.morphir.ir.Type.Definition 6 | import zio.test.magnolia.DeriveGen 7 | import zio.test.magnolia.DeriveGen._ 8 | 9 | trait TypeDefinitionDeriveGen { 10 | implicit def typeAliasDefinitionDeriveGen[A: DeriveGen]: DeriveGen[Definition.TypeAlias[A]] = 11 | DeriveGen.instance(TypeDefinitionGen.typeAliasDefinitionFromAttributes(DeriveGen[A])) 12 | 13 | implicit def customTypeDefinitionDeriveGen[A: DeriveGen]: DeriveGen[Definition.CustomType[A]] = 14 | DeriveGen.instance(TypeDefinitionGen.customTypeDefinitionFromAttributes(DeriveGen[A])) 15 | 16 | implicit def definitionDeriveGen[A: DeriveGen]: DeriveGen[Definition[A]] = 17 | DeriveGen.instance(TypeDefinitionGen.typeDefinition(DeriveGen[A])) 18 | } 19 | 20 | object TypeDefinitionDeriveGen extends TypeDefinitionDeriveGen 21 | -------------------------------------------------------------------------------- /project/modules/crossplatform.sc: -------------------------------------------------------------------------------- 1 | import upickle.default.{ReadWriter => RW, macroRW} 2 | 3 | sealed trait Platform { 4 | def name: String 5 | override def toString = name 6 | } 7 | object Platform { 8 | implicit val rw: RW[Platform] = RW.merge( 9 | macroRW[Platform.JVM], 10 | macroRW[Platform.JS], 11 | macroRW[Platform.Native] 12 | ) 13 | type JVM = Platform.JVM.type 14 | case object JVM extends Platform { 15 | implicit val rw: RW[JVM.type] = macroRW 16 | def name = "jvm" 17 | } 18 | type JS = Platform.JS.type 19 | case object JS extends Platform { 20 | implicit val rw: RW[JS.type] = macroRW 21 | def name = "js" 22 | } 23 | type Native = Platform.Native.type 24 | case object Native extends Platform { 25 | implicit val rw: RW[Native.type] = macroRW 26 | def name = "native" 27 | } 28 | 29 | def all: Set[Platform] = Set(JVM, JS, Native) 30 | } 31 | -------------------------------------------------------------------------------- /morphir/tests/test/src/org/finos/morphir/ir/internal/NonEmptyStringSpec.scala: -------------------------------------------------------------------------------- 1 | package org.finos.morphir 2 | package ir 3 | package internal 4 | 5 | import org.finos.morphir.testing.MorphirBaseSpec 6 | import types.NonEmptyString 7 | import zio.Console 8 | import zio.prelude.Validation 9 | import zio.test._ 10 | import zio.test.Assertion.isLeft 11 | 12 | object NonEmptyStringSpec extends MorphirBaseSpec { 13 | def spec = suite("NonEmptyString Spec")( 14 | test("Should error if making an empty string") { 15 | val actual = NonEmptyString.make("") 16 | assertTrue(actual == Validation.fail(" did not satisfy is non-empty String.")) 17 | // for { 18 | // res <- typeCheck(""" 19 | // import org.finos.morphir.ir.internal.types.NonEmptyString 20 | // val s:NonEmptyString = NonEmptyString("1") 21 | // """) 22 | // _ <- Console.printLine(s"res: $res") 23 | // } yield assert(res)(isLeft) 24 | } 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: assign and label scala-steward's PRs 3 | conditions: 4 | - author=scala-steward 5 | actions: 6 | label: 7 | add: ["type: dependencies"] 8 | - name: label scala-steward's breaking PRs 9 | conditions: 10 | - author=scala-steward 11 | - "body~=(labels: library-update, semver-major)|(labels: sbt-plugin-update, semver-major)" 12 | actions: 13 | label: 14 | add: ["type: breaking"] 15 | - name: merge Scala Steward's PRs 16 | conditions: 17 | - base=master 18 | - author=scala-steward 19 | - "body~=(labels: library-update, semver-minor)|(labels: library-update, semver-patch)|(labels: sbt-plugin-update, semver-minor)|(labels: sbt-plugin-update, semver-patch)|(labels: scalafix-rule-update)|(labels: test-library-update)" 20 | - "status-success=license/cla" 21 | - "status-success=ci" 22 | actions: 23 | merge: 24 | method: squash 25 | -------------------------------------------------------------------------------- /mill-build/src/mill/local/plugins/ci/release/Env.scala: -------------------------------------------------------------------------------- 1 | package mill.local.plugins.ci.release 2 | 3 | /** 4 | * The env variables that are necessary to sign and publish 5 | * 6 | * @param pgpSecret 7 | * base64 encoded secret 8 | * @param pgpPassword 9 | * password to unlock your secret 10 | * @param isTag 11 | * whether or not this is a stable release or not 12 | * @param sonatypeUser 13 | * your sonatype user 14 | * @param sonatypePassword 15 | * your sontatype password 16 | */ 17 | private[release] final case class Env( 18 | pgpSecret: String, 19 | pgpPassword: String, 20 | isTag: Boolean, 21 | sonatypeUser: String, 22 | sonatypePassword: String 23 | ) { 24 | 25 | /** 26 | * Sonatype creds in the format that Mill uses 27 | */ 28 | val sonatypeCreds: String = s"${sonatypeUser}:${sonatypePassword}" 29 | } 30 | 31 | object Env { 32 | implicit def rw: upickle.default.ReadWriter[Env] = 33 | upickle.default.macroRW 34 | } 35 | --------------------------------------------------------------------------------