Skip to content

Commit

Permalink
code changes for better scala code generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
nwokafor-choongsaeng committed Aug 30, 2023
1 parent 50bdb76 commit b5594f0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 9 additions & 0 deletions src/Morphir/IR/FormatVersion.elm
@@ -0,0 +1,9 @@
module Morphir.IR.FormatVersion exposing (..)

import Morphir.IR.Distribution exposing (Distribution)


type alias VersionedDistribution =
{ formatVersion : Int
, distribution : Distribution
}
2 changes: 1 addition & 1 deletion src/Morphir/IR/Value.elm
Expand Up @@ -374,7 +374,7 @@ typeAndValueToDefinition valueType value =
case ( body, bodyType ) of
( Lambda va (AsPattern _ (WildcardPattern _) argName) lambdaBody, Type.Function _ argType returnType ) ->
liftLambdaArguments
(args ++ [ ( argName, va, argType ) ])
(List.append args [ ( argName, va, argType ) ])
returnType
lambdaBody

Expand Down
6 changes: 3 additions & 3 deletions src/Morphir/Scala/PrettyPrinter.elm
Expand Up @@ -339,7 +339,7 @@ mapArgDecl opt argDecl =
Nothing ->
empty
in
mapModifiers argDecl.modifiers ++ argDecl.name ++ ": " ++ mapType opt argDecl.tpe ++ defaultValueDoc
mapModifiers argDecl.modifiers ++ prefixKeyword argDecl.name ++ ": " ++ mapType opt argDecl.tpe ++ defaultValueDoc


mapType : Options -> Type -> Doc
Expand Down Expand Up @@ -623,7 +623,7 @@ mapPattern pattern =
"Nil"

HeadTailMatch headPattern tailPattern ->
mapPattern headPattern ++ " :: " ++ mapPattern tailPattern
parens (mapPattern headPattern ++ " :: " ++ mapPattern tailPattern)

CommentedPattern childPattern message ->
mapPattern childPattern ++ " /* " ++ message ++ " */ "
Expand All @@ -643,7 +643,7 @@ mapLit lit =
"'" ++ String.fromChar char ++ "'"

StringLit string ->
"\"" ++ string ++ "\""
"\"\"\"" ++ string ++ "\"\"\""

IntegerLit int ->
String.fromInt int
Expand Down

0 comments on commit b5594f0

Please sign in to comment.