Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 02 18:45
    ybasket commented #368
  • Nov 29 20:09
    ybasket synchronize #368
  • Nov 29 19:29
    ybasket edited #368
  • Nov 29 19:28
    ybasket edited #368
  • Nov 29 19:27
    ybasket synchronize #368
  • Nov 29 17:41

    cquiroz on master

    Add Numeric.parseOption impleme… Add comment explaining dimensio… Merge branch 'master' into mast… and 1 more (compare)

  • Nov 29 17:41
    cquiroz closed #363
  • Nov 26 13:32
    ybasket synchronize #368
  • Nov 26 13:32
    ybasket synchronize #363
  • Nov 26 10:23

    cquiroz on master

    Fix typos Merge pull request #369 from bw… (compare)

  • Nov 26 10:23
    cquiroz closed #369
  • Nov 26 02:31
    bwignall opened #369
  • Nov 24 19:03
    ybasket synchronize #368
  • Nov 24 18:34
    ybasket synchronize #368
  • Nov 24 17:59
    ybasket synchronize #368
  • Nov 24 17:17
    ybasket synchronize #368
  • Nov 24 13:58
    ybasket edited #368
  • Nov 24 13:45
    ybasket opened #368
  • Nov 24 13:38
    ybasket synchronize #363
  • Nov 23 14:19
    ybasket synchronize #363
Derek Morr
@derekmorr
well, parse isn't public, so i don't know if deprecating it would do much, aside from make lots of compiler warnings since all of the apply methods call it
garyKeorkunian
@garyKeorkunian
@nrinaudo we shouldn't need to deprecate as it was always just internal to the lib
exactly
I'll try to get an updated PR in later tonight.
garyKeorkunian
@garyKeorkunian
The updated PR is ready
typelevel/squants#293
garyKeorkunian
@garyKeorkunian
PR #293 (Dimension.parse) and #294 (Currency udpates) are both ready for review
garyKeorkunian
@garyKeorkunian
PR's #293 and #294 have been merged.
garyKeorkunian
@garyKeorkunian
PR #295 is a quick fix to previous work needed to add the the new currencies to the default currency list. Should be quick review and approve
Carlos Quiroz
@cquiroz
We have accumulated several PRs, should we make a release?
Alex Cruise
@acruise
hey folks, I have an entity/metrics metamodel in which I'd like to record the unit of measure for metrics
Essentially I'd like to take the algebraic representation of RPM or km/h or °C and record that
I could leave a 1.0 in there as the actual quantity if it helps I guess
Really I want to ser/des the units themselves so I can compare them later
Alex Cruise
@acruise
Being able to convert between different scalar values is also interesting but a relatively easy problem
Alex Cruise
@acruise
howboutnow? ;)
Carlos Quiroz
@cquiroz
I’m not sure what you mean. Is it about serialization of Quantity?
Alex Cruise
@acruise
I'm looking for a way to ser/des units as metadata for numeric fields
So I can do an equality check when someone tries to do math on fields with known units
The compile-time type agreement is cool, but not what I'm after here :)
To get more concrete... In my metamodel, where the data dictionaries for customer streams and repositories are declared, I'd like to provide the ability to optionally annotate "this field is RPM, that field is degrees latitude, the other field is km/h"
The quantities themselves are numbers that come in at runtime as a result of queries or streams
And because the domain model is effectively infinite, I can't declare them statically as quantities-with-units
Alex Cruise
@acruise
Having a canonical opaque representation of the unit would be fine in the short- to medium-term, I just want to tell the user they're making a mistake
Eventually it'd be nice to have the units decomposable algebraically, so I could generate conversions
Eric Peters
@er1c
I was looking for something like Dimension.parseString(...) that would allow me to attempt to parse some files that are formatted like "2 in", "3 mm", "4 kg"and etc and identify if it is a length or weight/etc does that exist in squants?
Eric Peters
@er1c
I'm trying to get something like this to work val qty: Option[Quantity[_]] = X12CodeToUnitMap.get("IN").map{ uom: UnitOfMeasure[_] => uom.apply(6.0d) } but the typing continues to thwart me: (https://scastie.scala-lang.org/er1c/wSVcQmUYTM6LEdvw40jwLA)
garyKeorkunian
@garyKeorkunian
@er1c Generally you should know ahead of time what dimension a given quantity is. This is important for any subsequent operations. For example, if you parse "3 mm", and wish to use that in additional dimensional analysis, you need to know that it is Length when you right that code. If you attempt to parse "4 kg" and then use it like a length you will get error. If you are not using these values in any analysis (i.e., perhaps you are just storing or displaying the values), then you may not need Squants for that. A simple Pair[Double, String] will work as no dimensional type-safety is required for that.
Eric Peters
@er1c
@garyKeorkunian I'm primarily looking to parse two different datasources that each have their own criteria, but convert between UOM. For instance, if I have a brake pad in a database with a thickness of .25 inches, I have a mapping table from the source "inches" to the Inches LengthUnit as part of a Map, and I also know I need to convert it into mm for the European market based upon another mapping table that tells me "width" should be in mm instead of whatever the source UOM was :)
rabzu
@rabzu

How can I create a field in a case class that restricts it to a specific currency such as USD?

case class MyCurrency(usd: USD)

Carlos Quiroz
@cquiroz
Hi, I made a proposal PR to make a 1.4 release. What do you guys think? Shoeld we try to produce a new release?
Anton
@atk91
Hi everyone! What's the purpose of using Double as Information's underlying type? The Long should suit better, because, for example, there is no such N that N == N + 1 will evaluate to true. For example Bytes(Double.MaxValue / 2.0) == (Bytes(Double.MaxValue / 2.0) + Bytes(1.0)) will evaluate to true. Things like 3.5 bytes also does make no sense.
Carlos Quiroz
@cquiroz
You’re right, the type of should be abstracted away to let you use Double or other more appropriate numeric type
it is Double for historical reasons
Derek Morr
@derekmorr
We support bits, so having fractional bytes does make sense in that regard.
The use of Double is a well-known issue. So far no one has wanted to put in the work to rework the library onto an abstract numetic type.
Carlos Quiroz
@cquiroz
Yeah I tried to restart that
But had problems with the hierarchy of classes there
I’d simplify it in the process
In fact I can’t build squants on 2.13 due to the hirerachy
garyKeorkunian
@garyKeorkunian
Hey, all. Happy New Year! It's been a while since I've been able to look in on this. I did start work on abstracting the value type sometime ago, but it lead to some type-system whack-a-mole. You can find it in the experimental package in test.
Alex Cruise
@acruise
Any thoughts on my question from May last year about serialized quantityless units? :)
Refreshing memories... I want to record in my metadata catalog that the values in this random numeric field in a random data stream are °C
And that the values in this other field are RPM
And when a user asks me to add/subtract those, I want to check that the units are incompatible, and warn them not to... And if they're compatible (e.g. °C and °F) to insert the appropriate conversion in their function
Marius B. Kotsbak
@mkotsbak
Hi!
How do you get it to build properly in IntelliJ?
Marius B. Kotsbak
@mkotsbak
I get a ton of errors, both when importing using sbt and not
Sebastian Voss
@sebastianvoss
Hi All, I'm having a mass flow in kg/s (MassFlow((10, "kg/s"))) and I'm stuck to convert this to t/h. Can somebody point me to the right direction?
Tom Poczos
@TomPoczos
Hi, is there something along the lines of val currency = Currency.fromCode("USD") that would give me the default USD object?
Tom Poczos
@TomPoczos
found it, defaultCurrencyMap.., thanks anyway