packages feed

geodetic-types 0.0.1 → 0.0.2

raw patch · 4 files changed

+100/−3 lines, 4 filesdep ~dimensional

Dependency ranges changed: dimensional

Files

changelog.md view
@@ -1,3 +1,7 @@+0.0.2++* Add `LatLon` data type.+ 0.0.1  * This change log starts.
geodetic-types.cabal view
@@ -1,7 +1,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                  geodetic-types-version:               0.0.1+version:               0.0.2 synopsis:              Types for geodetic operations description:          <<http://i.imgur.com/uZnp9ke.png>>@@ -12,7 +12,7 @@ author:                Queensland Functional Programming Lab <oᴉ˙ldɟb@llǝʞsɐɥ> maintainer:            Queensland Functional Programming Lab <oᴉ˙ldɟb@llǝʞsɐɥ> copyright:             Copyright (C) 2018 Commonwealth Scientific and Industrial Research Organisation (CSIRO)-category:              Geodgraphy+category:              Geography build-type:            Simple extra-source-files:    changelog.md cabal-version:         >=1.10@@ -30,12 +30,13 @@                        , Geodetics.Types.Ellipsoid                        , Geodetics.Types.Helmert                        , Geodetics.Types.Latitude+                       , Geodetics.Types.LatLon                        , Geodetics.Types.Longitude                        , Geodetics.Types.TRF                           build-depends:         base              >= 4.8     && < 4.12                        , lens              >= 4.15    && < 4.18-                       , dimensional       >= 1       && < 1.2+                       , dimensional       >= 1.1     && < 1.2                        , semigroups        >= 0.9     && < 0.19    hs-source-dirs:      src
src/Geodetics/Types.hs view
@@ -8,5 +8,6 @@ import Geodetics.Types.Ellipsoid as T import Geodetics.Types.Helmert as T import Geodetics.Types.Latitude as T+import Geodetics.Types.LatLon as T import Geodetics.Types.Longitude as T import Geodetics.Types.TRF as T
+ src/Geodetics/Types/LatLon.hs view
@@ -0,0 +1,91 @@+{-# LANGUAGE NoImplicitPrelude #-}++module Geodetics.Types.LatLon(+  LatLon(..)+, HasLatLon(..)+, AsLatLon(..)+, ManyLatLon(..)+, GetLatLon(..)+, SetLatLon(..)+, FoldLatLon(..)+, IsLatLon(..)  +) where+ +import Control.Category(id)+import Control.Lens(Lens', Prism', Traversal', Getter, Setter', Fold, Iso')+import Data.Eq(Eq)+import Data.Functor(fmap)+import Data.Ord(Ord)+import Geodetics.Types.Latitude(Latitude, HasLatitude(latitude))+import Geodetics.Types.Longitude(Longitude, HasLongitude(longitude))+import Prelude(Show)++data LatLon =+  LatLon+    Latitude+    Longitude+  deriving (Eq, Ord, Show)++instance HasLatitude LatLon where+  latitude f (LatLon lt ln) =+    fmap (\lt' -> LatLon lt' ln) (f lt)++instance HasLongitude LatLon where+  longitude f (LatLon lt ln) =+    fmap (\ln' -> LatLon lt ln') (f ln)++class HasLatLon a where+  latlon ::+    Lens' a LatLon++instance HasLatLon LatLon where+  latlon =+    id++class ManyLatLon a => AsLatLon a where+  _LatLon ::+    Prism' a LatLon++instance AsLatLon LatLon where+  _LatLon =+    id++class (FoldLatLon a, SetLatLon a) => ManyLatLon a where+  _ManyLatLon ::+    Traversal' a LatLon++instance ManyLatLon LatLon where+  _ManyLatLon =+    id++class FoldLatLon a => GetLatLon a where+  _GetLatLon ::+    Getter a LatLon+    +instance GetLatLon LatLon where+  _GetLatLon =+    id++class SetLatLon a where+  _SetLatLon ::+    Setter' a LatLon+    +instance SetLatLon LatLon where+  _SetLatLon =+    id++class FoldLatLon a where+  _FoldLatLon ::+    Fold a LatLon+    +instance FoldLatLon LatLon where+  _FoldLatLon =+    id++class (HasLatLon a, AsLatLon a) => IsLatLon a where+  _IsLatLon ::+    Iso' a LatLon+    +instance IsLatLon LatLon where+  _IsLatLon =+    id