Angles (geometric), normalization and conversion: Difference between revisions

Content added Content deleted
(→‎{{header|Haskell}}: added solution)
m (→‎{{header|Haskell}}: minor details)
Line 1,440: Line 1,440:
The solution of this seemingly trivial task could be elegantly done by type classes. Each angle unit is represented as a distinct type, preventing from implicit combination of different units. Moreover, adding new units doesn't imply writing new transformers or normalizers.
The solution of this seemingly trivial task could be elegantly done by type classes. Each angle unit is represented as a distinct type, preventing from implicit combination of different units. Moreover, adding new units doesn't imply writing new transformers or normalizers.


Isomorphims between all angular types are defined via representation of full turns, according to the fact that they all form the same topological space, isomorphic to '''S'''¹.
Isomorphims between all angular types are defined via representation of full turns, according to the fact that they all form the same topological space, isomorphic to '''S'''¹ ≃ [0, 1).


<lang haskell>{-# LANGUAGE RankNTypes #-}
<lang haskell>{-# LANGUAGE RankNTypes #-}