i have a type mismatch error can you please help me fix this.pdf

S

i have a type mismatch error can you please help me fix this code type Customer = { Id: int IsVip: bool Credit: decimal } let getPurchases (customer: Customer) = if customer.Id % 2 = 0 then 120.0M else 80.0M let tryPromoteToVip (customer: Customer) = if getPurchases customer > 100.0M then { customer with IsVip = true } else customer let increaseCreditIfVip (customer: Customer) = if customer.IsVip then { customer with Credit = customer.Credit + 100.0M } else { customer with Credit = customer.Credit + 50.0M } let upgradeCustomerProcedural customer = let purchases = getPurchases customer let customer2 = tryPromoteToVip customer increaseCreditIfVip customer2 let upgradeCustomerNested customer = increaseCreditIfVip (tryPromoteToVip (customer |> getPurchases)) let upgradeCustomerComposed = getPurchases >> tryPromoteToVip >> increaseCreditIfVip let upgradeCustomerPiped customer = customer |> tryPromoteToVip |> increaseCreditIfVip |> getPurchases let customerVIP = { Id = 1; IsVip = true; Credit = 0.0M } let customerSTD = { Id = 2; IsVip = false; Credit = 100.0M } let assertVIP = upgradeCustomerComposed customerVIP = { Id = 1; IsVip = true; Credit = 100.0M } let assertSTDtoVIP = upgradeCustomerComposed customerSTD = { Id = 2; IsVip = true; Credit = 200.0M } let assertSTD = upgradeCustomerComposed { customerSTD with Id = 3; Credit = 50.0M } = { Id = 3; IsVip = false; Credit = 100.0M }.

i have a type mismatch error can you please help me fix this code
type Customer = {
Id: int
IsVip: bool
Credit: decimal
}
let getPurchases (customer: Customer) =
if customer.Id % 2 = 0 then
120.0M
else
80.0M
let tryPromoteToVip (customer: Customer) =
if getPurchases customer > 100.0M then
{ customer with IsVip = true }
else
customer
let increaseCreditIfVip (customer: Customer) =
if customer.IsVip then
{ customer with Credit = customer.Credit + 100.0M }
else
{ customer with Credit = customer.Credit + 50.0M }
let upgradeCustomerProcedural customer =
let purchases = getPurchases customer
let customer2 = tryPromoteToVip customer
increaseCreditIfVip customer2
let upgradeCustomerNested customer =
increaseCreditIfVip (tryPromoteToVip (customer |> getPurchases))
let upgradeCustomerComposed = getPurchases >> tryPromoteToVip >> increaseCreditIfVip
let upgradeCustomerPiped customer =
customer
|> tryPromoteToVip
|> increaseCreditIfVip
|> getPurchases
let customerVIP = { Id = 1; IsVip = true; Credit = 0.0M }
let customerSTD = { Id = 2; IsVip = false; Credit = 100.0M }
let assertVIP = upgradeCustomerComposed customerVIP = { Id = 1; IsVip = true; Credit = 100.0M
}
let assertSTDtoVIP = upgradeCustomerComposed customerSTD = { Id = 2; IsVip = true; Credit =
200.0M }
let assertSTD = upgradeCustomerComposed { customerSTD with Id = 3; Credit = 50.0M } = { Id =
3; IsVip = false; Credit = 100.0M }

Recomendados

httpsscikitlearnorgstablemoduleslinear_modelhtmllo.pdf von
httpsscikitlearnorgstablemoduleslinear_modelhtmllo.pdfhttpsscikitlearnorgstablemoduleslinear_modelhtmllo.pdf
httpsscikitlearnorgstablemoduleslinear_modelhtmllo.pdfsukhvir71
2 views1 Folie
i 1 pts What is a jagged matrix and how is it different .pdf von
i  1 pts What is a jagged matrix and how is it different .pdfi  1 pts What is a jagged matrix and how is it different .pdf
i 1 pts What is a jagged matrix and how is it different .pdfsukhvir71
6 views1 Folie
httpswwwcancergovnewseventspressreleases2020lung.pdf von
httpswwwcancergovnewseventspressreleases2020lung.pdfhttpswwwcancergovnewseventspressreleases2020lung.pdf
httpswwwcancergovnewseventspressreleases2020lung.pdfsukhvir71
2 views1 Folie
Husky corporation is a MNC operating with 75 exposure to Br.pdf von
Husky corporation is a MNC operating with 75 exposure to Br.pdfHusky corporation is a MNC operating with 75 exposure to Br.pdf
Husky corporation is a MNC operating with 75 exposure to Br.pdfsukhvir71
2 views1 Folie
i A content box using the lttextareagt tag which sho.pdf von
i A content box using the lttextareagt tag which sho.pdfi A content box using the lttextareagt tag which sho.pdf
i A content box using the lttextareagt tag which sho.pdfsukhvir71
2 views1 Folie
HuDs and Autnorties 014 points graded networkx has an imp.pdf von
HuDs and Autnorties 014 points graded networkx has an imp.pdfHuDs and Autnorties 014 points graded networkx has an imp.pdf
HuDs and Autnorties 014 points graded networkx has an imp.pdfsukhvir71
2 views1 Folie

Más contenido relacionado

Más de sukhvir71

Hoy en da se negocia en el mercado un bono T con cupn del .pdf von
Hoy en da se negocia en el mercado un bono T con cupn del .pdfHoy en da se negocia en el mercado un bono T con cupn del .pdf
Hoy en da se negocia en el mercado un bono T con cupn del .pdfsukhvir71
3 views1 Folie
Hunger Games Catching Fire uso de medios digitales y socia.pdf von
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdfsukhvir71
3 views1 Folie
Hypothesis What is your independent variable what will you.pdf von
Hypothesis What is your independent variable what will you.pdfHypothesis What is your independent variable what will you.pdf
Hypothesis What is your independent variable what will you.pdfsukhvir71
2 views1 Folie
I dont have any information left i sended as it is in my te.pdf von
I dont have any information left i sended as it is in my te.pdfI dont have any information left i sended as it is in my te.pdf
I dont have any information left i sended as it is in my te.pdfsukhvir71
2 views1 Folie
I need code to solve following comments include ltasse.pdf von
I need code to solve following comments    include ltasse.pdfI need code to solve following comments    include ltasse.pdf
I need code to solve following comments include ltasse.pdfsukhvir71
62 views2 Folien
I need an excel formula that will return 1 for HE17HE21 and.pdf von
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdfsukhvir71
3 views1 Folie

Más de sukhvir71(20)

Hoy en da se negocia en el mercado un bono T con cupn del .pdf von sukhvir71
Hoy en da se negocia en el mercado un bono T con cupn del .pdfHoy en da se negocia en el mercado un bono T con cupn del .pdf
Hoy en da se negocia en el mercado un bono T con cupn del .pdf
sukhvir713 views
Hunger Games Catching Fire uso de medios digitales y socia.pdf von sukhvir71
Hunger Games Catching Fire uso de medios digitales y socia.pdfHunger Games Catching Fire uso de medios digitales y socia.pdf
Hunger Games Catching Fire uso de medios digitales y socia.pdf
sukhvir713 views
Hypothesis What is your independent variable what will you.pdf von sukhvir71
Hypothesis What is your independent variable what will you.pdfHypothesis What is your independent variable what will you.pdf
Hypothesis What is your independent variable what will you.pdf
sukhvir712 views
I dont have any information left i sended as it is in my te.pdf von sukhvir71
I dont have any information left i sended as it is in my te.pdfI dont have any information left i sended as it is in my te.pdf
I dont have any information left i sended as it is in my te.pdf
sukhvir712 views
I need code to solve following comments include ltasse.pdf von sukhvir71
I need code to solve following comments    include ltasse.pdfI need code to solve following comments    include ltasse.pdf
I need code to solve following comments include ltasse.pdf
sukhvir7162 views
I need an excel formula that will return 1 for HE17HE21 and.pdf von sukhvir71
I need an excel formula that will return 1 for HE17HE21 and.pdfI need an excel formula that will return 1 for HE17HE21 and.pdf
I need an excel formula that will return 1 for HE17HE21 and.pdf
sukhvir713 views
Hydrologic Budget Exercises A For each of the following sce.pdf von sukhvir71
Hydrologic Budget Exercises A For each of the following sce.pdfHydrologic Budget Exercises A For each of the following sce.pdf
Hydrologic Budget Exercises A For each of the following sce.pdf
sukhvir7113 views
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf von sukhvir71
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdfHxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
Hxxxp19x21 H5TNii5x21 c Why akould you espect th.pdf
sukhvir712 views
i Local supranational and governmental organisations amp.pdf von sukhvir71
i Local supranational and governmental organisations amp.pdfi Local supranational and governmental organisations amp.pdf
i Local supranational and governmental organisations amp.pdf
sukhvir713 views
I JUST NEED THE GRAPHH FILE PLEASE In this project yo.pdf von sukhvir71
I JUST NEED THE GRAPHH FILE PLEASE      In this project yo.pdfI JUST NEED THE GRAPHH FILE PLEASE      In this project yo.pdf
I JUST NEED THE GRAPHH FILE PLEASE In this project yo.pdf
sukhvir712 views
i La mediana es la medida de tendencia central que utiliza.pdf von sukhvir71
i La mediana es la medida de tendencia central que utiliza.pdfi La mediana es la medida de tendencia central que utiliza.pdf
i La mediana es la medida de tendencia central que utiliza.pdf
sukhvir712 views
i How does Pauly view the need for public insurance or just.pdf von sukhvir71
i How does Pauly view the need for public insurance or just.pdfi How does Pauly view the need for public insurance or just.pdf
i How does Pauly view the need for public insurance or just.pdf
sukhvir713 views
Howard Ling is a famous artist with two galleries in Hawaii.pdf von sukhvir71
Howard Ling is a famous artist with two galleries in Hawaii.pdfHoward Ling is a famous artist with two galleries in Hawaii.pdf
Howard Ling is a famous artist with two galleries in Hawaii.pdf
sukhvir714 views
I How will u appl these steps to tackle vaccinatain sketic.pdf von sukhvir71
I How will u appl these steps to tackle vaccinatain sketic.pdfI How will u appl these steps to tackle vaccinatain sketic.pdf
I How will u appl these steps to tackle vaccinatain sketic.pdf
sukhvir712 views
i Ipts Compute the weakest precondition for the following.pdf von sukhvir71
i Ipts Compute the weakest precondition for the following.pdfi Ipts Compute the weakest precondition for the following.pdf
i Ipts Compute the weakest precondition for the following.pdf
sukhvir712 views
I have the LinkedList project and the input file path and ou.pdf von sukhvir71
I have the LinkedList project and the input file path and ou.pdfI have the LinkedList project and the input file path and ou.pdf
I have the LinkedList project and the input file path and ou.pdf
sukhvir713 views
I have a lab for structured programming and I have to write .pdf von sukhvir71
I have a lab for structured programming and I have to write .pdfI have a lab for structured programming and I have to write .pdf
I have a lab for structured programming and I have to write .pdf
sukhvir712 views
I have a problem it says unresolved variable or type student.pdf von sukhvir71
I have a problem it says unresolved variable or type student.pdfI have a problem it says unresolved variable or type student.pdf
I have a problem it says unresolved variable or type student.pdf
sukhvir712 views
i For 10 marks Map the stock and flow structure drawing .pdf von sukhvir71
i For 10 marks Map the stock and flow structure drawing .pdfi For 10 marks Map the stock and flow structure drawing .pdf
i For 10 marks Map the stock and flow structure drawing .pdf
sukhvir712 views
I have a Julia JuMP optimization problem model ModelGLPK.pdf von sukhvir71
I have a Julia JuMP optimization problem model  ModelGLPK.pdfI have a Julia JuMP optimization problem model  ModelGLPK.pdf
I have a Julia JuMP optimization problem model ModelGLPK.pdf
sukhvir713 views

Último

Solar System and Galaxies.pptx von
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptxDrHafizKosar
106 views26 Folien
CUNY IT Picciano.pptx von
CUNY IT Picciano.pptxCUNY IT Picciano.pptx
CUNY IT Picciano.pptxapicciano
54 views17 Folien
Drama KS5 Breakdown von
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 BreakdownWestHatch
98 views2 Folien
The Accursed House by Émile Gaboriau von
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile GaboriauDivyaSheta
223 views15 Folien
Ch. 7 Political Participation and Elections.pptx von
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptxRommel Regala
111 views11 Folien
CONTENTS.pptx von
CONTENTS.pptxCONTENTS.pptx
CONTENTS.pptxiguerendiain
62 views17 Folien

Último(20)

Solar System and Galaxies.pptx von DrHafizKosar
Solar System and Galaxies.pptxSolar System and Galaxies.pptx
Solar System and Galaxies.pptx
DrHafizKosar106 views
CUNY IT Picciano.pptx von apicciano
CUNY IT Picciano.pptxCUNY IT Picciano.pptx
CUNY IT Picciano.pptx
apicciano54 views
Drama KS5 Breakdown von WestHatch
Drama KS5 BreakdownDrama KS5 Breakdown
Drama KS5 Breakdown
WestHatch98 views
The Accursed House by Émile Gaboriau von DivyaSheta
The Accursed House  by Émile GaboriauThe Accursed House  by Émile Gaboriau
The Accursed House by Émile Gaboriau
DivyaSheta223 views
Ch. 7 Political Participation and Elections.pptx von Rommel Regala
Ch. 7 Political Participation and Elections.pptxCh. 7 Political Participation and Elections.pptx
Ch. 7 Political Participation and Elections.pptx
Rommel Regala111 views
Classification of crude drugs.pptx von GayatriPatra14
Classification of crude drugs.pptxClassification of crude drugs.pptx
Classification of crude drugs.pptx
GayatriPatra14101 views
Sociology KS5 von WestHatch
Sociology KS5Sociology KS5
Sociology KS5
WestHatch85 views
Psychology KS5 von WestHatch
Psychology KS5Psychology KS5
Psychology KS5
WestHatch119 views
REPRESENTATION - GAUNTLET.pptx von iammrhaywood
REPRESENTATION - GAUNTLET.pptxREPRESENTATION - GAUNTLET.pptx
REPRESENTATION - GAUNTLET.pptx
iammrhaywood138 views
Create a Structure in VBNet.pptx von Breach_P
Create a Structure in VBNet.pptxCreate a Structure in VBNet.pptx
Create a Structure in VBNet.pptx
Breach_P78 views
The basics - information, data, technology and systems.pdf von JonathanCovena1
The basics - information, data, technology and systems.pdfThe basics - information, data, technology and systems.pdf
The basics - information, data, technology and systems.pdf
JonathanCovena1146 views
When Sex Gets Complicated: Porn, Affairs, & Cybersex von Marlene Maheu
When Sex Gets Complicated: Porn, Affairs, & CybersexWhen Sex Gets Complicated: Porn, Affairs, & Cybersex
When Sex Gets Complicated: Porn, Affairs, & Cybersex
Marlene Maheu85 views
Education and Diversity.pptx von DrHafizKosar
Education and Diversity.pptxEducation and Diversity.pptx
Education and Diversity.pptx
DrHafizKosar193 views
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively von PECB
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks EffectivelyISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
ISO/IEC 27001 and ISO/IEC 27005: Managing AI Risks Effectively
PECB 623 views

i have a type mismatch error can you please help me fix this.pdf

  • 1. i have a type mismatch error can you please help me fix this code type Customer = { Id: int IsVip: bool Credit: decimal } let getPurchases (customer: Customer) = if customer.Id % 2 = 0 then 120.0M else 80.0M let tryPromoteToVip (customer: Customer) = if getPurchases customer > 100.0M then { customer with IsVip = true } else customer let increaseCreditIfVip (customer: Customer) = if customer.IsVip then { customer with Credit = customer.Credit + 100.0M } else { customer with Credit = customer.Credit + 50.0M } let upgradeCustomerProcedural customer = let purchases = getPurchases customer let customer2 = tryPromoteToVip customer increaseCreditIfVip customer2 let upgradeCustomerNested customer = increaseCreditIfVip (tryPromoteToVip (customer |> getPurchases)) let upgradeCustomerComposed = getPurchases >> tryPromoteToVip >> increaseCreditIfVip let upgradeCustomerPiped customer = customer |> tryPromoteToVip |> increaseCreditIfVip |> getPurchases let customerVIP = { Id = 1; IsVip = true; Credit = 0.0M } let customerSTD = { Id = 2; IsVip = false; Credit = 100.0M } let assertVIP = upgradeCustomerComposed customerVIP = { Id = 1; IsVip = true; Credit = 100.0M } let assertSTDtoVIP = upgradeCustomerComposed customerSTD = { Id = 2; IsVip = true; Credit =
  • 2. 200.0M } let assertSTD = upgradeCustomerComposed { customerSTD with Id = 3; Credit = 50.0M } = { Id = 3; IsVip = false; Credit = 100.0M }