manifolds-core 0.5.0.1 → 0.5.0.2
raw patch · 2 files changed
+14/−11 lines, 2 files
Files
- Math/Manifold/Core/Types/Internal.hs +13/−10
- manifolds-core.cabal +1/−1
Math/Manifold/Core/Types/Internal.hs view
@@ -10,6 +10,7 @@ -- Several low-dimensional manifolds, represented in some simple way as Haskell -- data types. All these are in the 'PseudoAffine' class. -- +{-# LANGUAGE DeriveGeneric #-} module Math.Manifold.Core.Types.Internal where@@ -18,29 +19,31 @@ import Data.Fixed (mod') +import GHC.Generics + -- | The zero-dimensional sphere is actually just two points. Implementation might -- therefore change to @ℝ⁰ 'Control.Category.Constrained.+' ℝ⁰@: the disjoint sum of two -- single-point spaces.-data S⁰ = PositiveHalfSphere | NegativeHalfSphere deriving(Eq, Show)+data S⁰ = PositiveHalfSphere | NegativeHalfSphere deriving(Eq, Show, Generic) -data ℝP⁰ = ℝPZero deriving (Eq, Show)+data ℝP⁰ = ℝPZero deriving (Eq, Show, Generic) -- | The unit circle. newtype S¹ = S¹Polar { φParamS¹ :: Double -- ^ Must be in range @[-π, π[@.- } deriving (Show)+ } deriving (Show, Generic) instance Eq S¹ where S¹Polar φ == S¹Polar φ' = φ `mod'` (2*pi) == φ' `mod'` (2*pi) newtype ℝP¹ = HemisphereℝP¹Polar { φParamℝP¹ :: Double -- ^ Range @[-π\/2,π\/2[@.- } deriving (Show)+ } deriving (Show, Generic) -- | The ordinary unit sphere. data S² = S²Polar { ϑParamS² :: !Double -- ^ Range @[0, π[@. , φParamS² :: !Double -- ^ Range @[-π, π[@.- } deriving (Show)+ } deriving (Show, Generic) instance Eq S² where S²Polar θ φ == S²Polar θ' φ'@@ -54,7 +57,7 @@ -- passes through the hemisphere. data ℝP² = HemisphereℝP²Polar { ϑParamℝP² :: !Double -- ^ Range @[0, π/2]@. , φParamℝP² :: !Double -- ^ Range @[-π, π[@.- } deriving (Show)+ } deriving (Show, Generic) -- | The standard, closed unit disk. Homeomorphic to the cone over 'S¹', but not in the@@ -62,7 +65,7 @@ -- the almost identical ADT definition, to the projective space 'ℝP²'!) data D² = D²Polar { rParamD² :: !Double -- ^ Range @[0, 1]@. , φParamD² :: !Double -- ^ Range @[-π, π[@.- } deriving (Show)+ } deriving (Show, Generic) -- | A (closed) cone over a space @x@ is the product of @x@ with the closed interval 'D¹' -- of “heights”,@@ -72,7 +75,7 @@ -- special case @x = 'S¹'@. data CD¹ x = CD¹ { hParamCD¹ :: !Double -- ^ Range @[0, 1]@ , pParamCD¹ :: !x -- ^ Irrelevant at @h = 0@.- } deriving (Show)+ } deriving (Show, Generic) -- | An open cone is homeomorphic to a closed cone without the “lid”,@@ -81,12 +84,12 @@ -- more natural to express it as the entire real ray, hence the name. data Cℝay x = Cℝay { hParamCℝay :: !Double -- ^ Range @[0, ∞[@ , pParamCℝay :: !x -- ^ Irrelevant at @h = 0@.- } deriving (Show)+ } deriving (Show, Generic) -- | The “one-dimensional disk” – really just the line segment between -- the two points -1 and 1 of 'S⁰', i.e. this is simply a closed interval. newtype D¹ = D¹ { xParamD¹ :: Double -- ^ Range @[-1, 1]@.- } deriving (Show)+ } deriving (Show, Generic) type ℝ = Double type ℝ⁰ = ZeroDim ℝ
manifolds-core.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: manifolds-core-version: 0.5.0.1+version: 0.5.0.2 synopsis: The basic classes for the manifolds hierarchy. description: The basic classes for the <http://hackage.haskell.org/package/manifolds manifolds> hierarchy.