packages feed

Octree 0.5 → 0.5.1

raw patch · 5 files changed

+49/−26 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Data/Octree.hs view
@@ -12,4 +12,5 @@  import Prelude hiding(lookup) import Data.Octree.Internal+import Data.Octree.Instances() 
+ Data/Octree/Instances.hs view
@@ -0,0 +1,40 @@+module Data.Octree.Instances where++import Data.Octree.Internal++-- Additional instances for convenience++import Data.Functor+import Data.Foldable hiding(foldr1)+import Data.Traversable++import Data.Monoid++instance Functor Octree where+  fmap f (Leaf l) = Leaf . fmap (\(c, a) -> (c, f a)) $  l+  fmap f (Node { split = sp,+                 nwu   = anwu,+                 nwd   = anwd,+                 neu   = aneu,+                 ned   = aned,+                 swu   = aswu,+                 swd   = aswd,+                 seu   = aseu,+                 sed   = ased }) = Node { split = sp,+                                          nwu   = fmap f anwu,+                                          nwd   = fmap f anwd,+                                          neu   = fmap f aneu,+                                          ned   = fmap f aned,+                                          swu   = fmap f aswu,+                                          swd   = fmap f aswd,+                                          seu   = fmap f aseu,+                                          sed   = fmap f ased }++-- TODO: test Foldable instance+instance Foldable Octree where+  foldMap f (Leaf l)                = foldMap (f . snd) l+  foldMap f n@(Node { split = sp }) = Prelude.foldr1 mappend . map (foldMap f) . subnodes $ n++-- TODO: test Traversable instance+--instance Traversable where+
Data/Octree/Internal.hs view
@@ -6,7 +6,8 @@                             octreeStep, octantDistance, splitBy', joinStep, splitStep, allOctants, octantDistance',                             cmp,                             pickClosest,-                            depth, size+                            depth, size,+                            subnodes                             ) where  import Data.Vector.V3@@ -33,26 +34,6 @@ data Octree a = Node { split :: Vector3,                        nwu, nwd, neu, ned, swu, swd, seu, sed :: Octree a } |                 Leaf { unLeaf :: [(Vector3, a)] }  deriving (Show)--instance Functor Octree where-  fmap f (Leaf l) = Leaf . fmap (Control.Arrow.second f) $  l-  fmap f (Node { split = sp,-                 nwu   = anwu,-                 nwd   = anwd,-                 neu   = aneu,-                 ned   = aned,-                 swu   = aswu,-                 swd   = aswd,-                 seu   = aseu,-                 sed   = ased }) = Node { split = sp,-                                          nwu   = fmap f anwu,-                                          nwd   = fmap f anwd,-                                          neu   = fmap f aneu,-                                          ned   = fmap f aned,-                                          swu   = fmap f aswu,-                                          swd   = fmap f aswd,-                                          seu   = fmap f aseu,-                                          sed   = fmap f ased }  -- | Enumerated type to indicate octants in 3D-space relative to given center. data ODir = SWD | SED | NWD | NED | SWU | SEU | NWU | NEU deriving (Eq, Ord, Enum, Show, Bounded)
Octree.cabal view
@@ -1,5 +1,5 @@ name:                Octree-version:             0.5+version:             0.5.1 stability:           beta homepage:            https://github.com/mgajda/octree package-url:         http://hackage.haskell.org/package/octree@@ -26,7 +26,7 @@ Library    build-depends:    base>=4.0 && < 4.7, AC-Vector >= 2.3.0, QuickCheck >= 2.4.0    exposed-modules:  Data.Octree-   other-modules:    Data.Octree.Internal+   other-modules:    Data.Octree.Internal, Data.Octree.Instances    exposed:          True    extensions:       ScopedTypeVariables @@ -36,9 +36,9 @@   Main-is:           tests/test_Octree.hs  Test-suite readme-  type:           exitcode-stdio-1.0+  type:           exitcode-stdio-1.0   -- We have a symlink: README.lhs -> README.md-  main-is:        README.lhs+  main-is:        README.lhs   Build-depends:  base>=4.0 && < 4.7, AC-Vector >= 2.3.0, QuickCheck >= 2.4.0, markdown-unlit-  ghc-options:    -pgmL markdown-unlit+  ghc-options:    -pgmL markdown-unlit 
tests/test_Octree.hs view
@@ -2,6 +2,7 @@ module Main(main) where  import Data.Octree.Internal+import Data.Octree.Instances() --import Data.Octree() -- test that interface module is not broken import Prelude hiding(lookup) import Data.List(sort, sortBy)