lambdista / money Goto Github PK
View Code? Open in Web Editor NEWScala DSL for money-related operations
License: Apache License 2.0
Scala DSL for money-related operations
License: Apache License 2.0
What do you think about having an implicit currency?
That way you could do:
val x: Money = 1
val z = Money(1.00)
Hi,
I'm using yr Money class to represent product prices. I have a bill of products class that calculates totals from line items by summing using map over Vector of line items, etc. Standard stuff. I was using Double as the price, but when I switched to yr Money, I get compile errors:
[error] /Users/k/work/bofe/play/app/models/Life.scala:181: could not find implicit value for parameter num: Numeric[models.BillOfProducts.Price]
[error] val theTotal = t.map(calcItem).map(_.price).sum
Of course if I say .map(_price.amount).sum instead, it compiles, but then the return type isn't Money any more.
Thoughts?
I probably don't need to test this but:
[info] - must convert to GBP from USD correctly *** FAILED ***
[info] 356921.16698 GBP was not equal to 356921.16698 GBP (ModelSpec.scala:115)
Hi, i want to use your api in order to convert currencies in a big data project. I have found that there is at least one currency that is not actually contemplated within Currency trait, CLF, which means Chilean Unidad de Fomento.
What do i have to do? add myself to Currency.scala file this line?
object CLF extends Currency {
val getCode : String = "CLF"
override val toString = getCode
}
Nifty DSL! Kind of surprised you can't do this tho...
val a = 1(USD)
val b = 2(EUR)
val c = a / b
Although this works...
val c = a / b.value
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.