#1 Merged
Deleted repository
default (a19e56840aba)
  1. Takayuki Muranushi

I'm sorry to mess up. I don't know how to issue multiple pull request without branches. Please instruct me of proper ways if you want more tidy patches....

  • fix issue #2.

SI metric prefixes now treats the value more nicely.

I had to export Value(..) from UnitTyped.hs to do this. Maybe we'd like to add an "Internal.hs" module that exports everything, to keep exports of UnitTyped.hs compact.

  • rename (~>) to (*|)

I respect your decision to introduce an explicit symbol for multiplication between a unit and a scalar. However, I felt a little strangeness with the choice of symbol (~>) .

My suggestion, (*|) stands for a combination of a multiplication and a square bracket, since in some fields of science, square brackets are used to introduce the physical units.

see e.g. https://www.google.co.jp/search?q=physical+unit+square+bracket

p.s. I made this pull request for practice. Although I personally prefer the new symbol (*|), please reject this request if you disagree.

  • Issues #2: Behavior of SI prefixes on quantities resolved

Comments (2)

  1. Thijs Alkemade repo owner


    I think I too like *| more than ~>, it emphasizes that it's a multiplication, and ~> would probably collide with other libraries more. Do you think we should maybe also replace .*., ./. etc. with |*|, |/|? We could make a convention to use a | on the side of unit-bearing values, and introduce stuff like |*, |/ for easily working with dimensionless values.

    I also agree with your change regarding #2. However, for the situation in that example, I would recommend simply adding a new unit SolarMass, with an instance instance Convertible MassDimension SolarMass. Otherwise, coercions, for example, will still not work:

        > let solarMass = 1.99e30 *| kilo gram
        > 2 *| gram `as` solarMass 
        2.0e-3 kg
  2. Takayuki Muranushi author

    Hello Thijs, and thank you for handling this (rather dirty) patch!

    I also think (|*), (|/) are nice conventions. And I agree that it is better idea to create SolarMass as a unit, when we need coersion. Coersions are a convenient thing that dimensional package didn't have!