Skip to content

Commit

Permalink
Merge pull request #84 from ccap/blarg
Browse files Browse the repository at this point in the history
Blarg!
  • Loading branch information
cwinebrinner authored Feb 1, 2022
2 parents da60cd9 + 35ae2d8 commit 5e684c7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 118 deletions.
4 changes: 0 additions & 4 deletions runtests
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,4 @@ for i in samples/*.tmpl; do
# TODO: Test compilation of generated output.
done

# We can at least test compile this one for now

./codegen.js -p Test.Generated -m purs -o test/generated samples/SelfContained.tmpl

spago test
73 changes: 36 additions & 37 deletions samples/Case.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,40 @@ purs: Samples.Case
import Domains

type Case: {
caseNo: Domains.CaseNoT
countyNo: Domains.CountyNoT
caseType: Domains.CaseTypeT
filingDate: Domains.DateT
isConfidential: Boolean
isFiledWoCtofc: Boolean
lastChargeSeqNo: Domains.ChargeSeqNoT
lastCvJgSeqNo: Domains.CivilJdgmtSeqNoT
lastHistSeqNo: Domains.HistSeqNoT
lastPartySeqNo: Domains.PartyNoT
lastRelSeqNo: Domains.RelSeqNoT
statusCode: Domains.StatusCodeT
isSeal: Boolean
isExpunge: Boolean
isElectronicFiling: Boolean
isPartySeal: Boolean
bondId: Maybe Domains.BondIdT
branchId: Maybe Domains.BranchIdT
caption: Maybe Domains.CaptionT
daCaseNo: Maybe Domains.DaCaseNoT
dispCtofcNo: Maybe Domains.CtofcNoT
fileCtofcDate: Maybe Domains.DateT
filingCtofcNo: Maybe Domains.CtofcNoT
issAgencyNo: Maybe Domains.IssAgencyNoT
maintCode: Maybe Domains.MaintCodeT
oldCaseNo: Maybe String
plntfAgencyNo: Maybe Domains.PlntfAgencyNoT
previousRespCo: Maybe Domains.CtofcNoT
prosAgencyNo: Maybe Domains.ProsAgencyNoT
prosAtty: Maybe Domains.AttyNoT
respCtofcNo: Maybe Domains.CtofcNoT
wcisClsCode: Maybe Domains.WcisClsCodeT
unifiedCaseNo: Maybe Domains.UnifiedCaseNoT
statClsCode: Maybe Domains.WcisClsCodeT
optInCode: Maybe Domains.PublicOptInCodeT
lastDocNumber: Domains.CaseDocNoT
caseNo: Domains.CaseNoT,
countyNo: Domains.CountyNoT,
caseType: Domains.CaseTypeT,
filingDate: Domains.DateT,
isConfidential: Boolean,
isFiledWoCtofc: Boolean,
lastChargeSeqNo: Domains.ChargeSeqNoT,
lastCvJgSeqNo: Domains.CivilJdgmtSeqNoT,
lastHistSeqNo: Domains.HistSeqNoT,
lastPartySeqNo: Domains.PartyNoT,
lastRelSeqNo: Domains.RelSeqNoT,
statusCode: Domains.StatusCodeT,
isSeal: Boolean,
isExpunge: Boolean,
isElectronicFiling: Boolean,
isPartySeal: Boolean,
bondId: Maybe Domains.BondIdT,
branchId: Maybe Domains.BranchIdT,
caption: Maybe Domains.CaptionT,
daCaseNo: Maybe Domains.DaCaseNoT,
dispCtofcNo: Maybe Domains.CtofcNoT,
fileCtofcDate: Maybe Domains.DateT,
filingCtofcNo: Maybe Domains.CtofcNoT,
issAgencyNo: Maybe Domains.IssAgencyNoT,
maintCode: Maybe Domains.MaintCodeT,
oldCaseNo: Maybe String,
plntfAgencyNo: Maybe Domains.PlntfAgencyNoT,
previousRespCo: Maybe Domains.CtofcNoT,
prosAgencyNo: Maybe Domains.ProsAgencyNoT,
prosAtty: Maybe Domains.AttyNoT,
respCtofcNo: Maybe Domains.CtofcNoT,
wcisClsCode: Maybe Domains.WcisClsCodeT,
unifiedCaseNo: Maybe Domains.UnifiedCaseNoT,
statClsCode: Maybe Domains.WcisClsCodeT,
optInCode: Maybe Domains.PublicOptInCodeT,
lastDocNumber: Domains.CaseDocNoT,
}

42 changes: 21 additions & 21 deletions samples/County.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,34 +33,34 @@ type AssessFacilityId: wrap Int
type SomethingMoney: wrap Decimal

type County: {
countyNo: Domains.CountyNoT
countyNoX: CountyNo
countyName: CountyName
assessFacilityId: Maybe AssessFacilityId
soapPort: Int
countyNo: Domains.CountyNoT,
countyNoX: CountyNo,
countyName: CountyName,
assessFacilityId: Maybe AssessFacilityId,
soapPort: Int,
}

type Big: {
a1: Int
b1: String
c1: Decimal
d1: Boolean
a2: Int
b2: String
c2: Decimal
d2: Boolean
a3: Int
b3: String
c3: Decimal
d3: Boolean
a4: Int
b4: String
c4: Decimal
d4: Boolean
b1: String,
c1: Decimal,
d1: Boolean,
a2: Int,
b2: String,
c2: Decimal,
d2: Boolean,
a3: Int,
b3: String,
c3: Decimal,
d3: Boolean,
a4: Int,
b4: String,
c4: Decimal,
d4: Boolean,
}

type Response: {
counties: Array County
counties: Array County,
}

type CountyEnum: [
Expand Down
55 changes: 0 additions & 55 deletions samples/SelfContained.tmpl

This file was deleted.

2 changes: 1 addition & 1 deletion src/Ccap/Codegen/Scala.purs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ sumTypeDecoder name constructors = do
failureBranch = text ("case (n, l) => sys.error(s\"Match error on type " <> name <> " for constructor $n with ${l.length} parameters\")")

func =
text "val d: Decoder.Form[M, Blarg] ="
text ("val d: Decoder.Form[M, " <> name <> "] =")
// indented (text "p match" `curly` (branches `NonEmptyArray.snoc` failureBranch))
// text "d.disjunction"
pure
Expand Down

0 comments on commit 5e684c7

Please sign in to comment.