0

Quick question: Using dimensional GHC infers the type of testRate = 10 *~ (watt / second) to be:

testRate
  :: Numeric.Units.Dimensional.Quantity
       (Numeric.Units.Dimensional.Dim
          (numtype-1.0.1:Numeric.NumType.Pos
             numtype-1.0.1:Numeric.NumType.Pos1)
          (numtype-1.0.1:Numeric.NumType.Pos
             numtype-1.0.1:Numeric.NumType.Zero)
          (numtype-1.0.1:Numeric.NumType.Neg
             (numtype-1.0.1:Numeric.NumType.Neg
                numtype-1.0.1:Numeric.NumType.Neg2))
          numtype-1.0.1:Numeric.NumType.Zero
          numtype-1.0.1:Numeric.NumType.Zero
          numtype-1.0.1:Numeric.NumType.Zero
          numtype-1.0.1:Numeric.NumType.Zero)
       a

What would be the short type of testRate? And how do I derive the type of other such units?

4

2 回答 2

3

如果你切换到Dimension-tf你可以把它写成

testRate :: Quantity (Div DPower DTime) a

我不认为有一个很好的通用方法来派生这些类型,只需写下你认为单位应该是的类型等价物(使用Muland Div)。

于 2013-12-13T14:08:34.257 回答
0

短类型是什么意思?您可以做的最好的事情是删除所有模块限定符,例如

testRate
  :: Quantity
       (Dim
          (Pos Pos1)
          (Pos Zero)
          (Neg (Neg Neg2))
          Zero
          Zero
          Zero
          Zero)
       a
于 2013-12-13T13:47:19.603 回答