Like if I have a cartesian coordinates in one reference frame, can I use them in a type-safe way? E.g. not add two vectors in two reference frames? Same for polar coordinates?
The `dimensional` library doesn't provide this, no. However, it's easy to 'tag' data in Haskell using phantom types. For example, for vectors in reference frames:
newtype Framed f a = MkFramed (Vector a)
add :: Framed f a -> Framed f a -> Framed f a
add (MkFramed vec1) (MkFramed vec2) = ... add vec1 and vec2
data ReferenceFrame1
data ReferenceFrame2
v1 :: Framed ReferenceFrame1 Double
v1 = ...
v2 :: Framed ReferenceFrame2 Double
v2 = ...
main :: IO ()
main = print $ v1 `add` v2 -- will not type check
Like if I have a cartesian coordinates in one reference frame, can I use them in a type-safe way? E.g. not add two vectors in two reference frames? Same for polar coordinates?
Etc.