Octree 0.5.2 → 0.5.3
raw patch · 7 files changed
+18/−47 lines, 7 files
Files
- Data/Octree.hs +0/−1
- Data/Octree/Instances.hs +0/−40
- Data/Octree/Internal.hs +7/−2
- Octree.cabal +3/−2
- README.lhs +4/−1
- changelog +4/−0
- tests/test_Octree.hs +0/−1
Data/Octree.hs view
@@ -12,5 +12,4 @@ import Prelude hiding(lookup) import Data.Octree.Internal-import Data.Octree.Instances()
− Data/Octree/Instances.hs
@@ -1,40 +0,0 @@-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
@@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables, DisambiguateRecordFields #-}+{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} module Data.Octree.Internal(Vector3(..), dist, Octree(..), lookup, nearest, withinRange, fromList, toList, insert, -- internal@@ -10,11 +11,15 @@ subnodes ) where +import Data.Functor (Functor (..))+import Data.Foldable (Foldable (..))+import Data.Traversable(Traversable(..))+ import Data.Vector.V3 import Data.Vector.Class --import Text.Show-import Prelude hiding(lookup)+import Prelude hiding(lookup, foldr) import Data.List(sort, sortBy) import Data.Maybe(maybeToList, listToMaybe) import Data.Bits((.&.))@@ -33,7 +38,7 @@ -- | Datatype for nodes within Octree. data Octree a = Node { split :: Vector3, nwu, nwd, neu, ned, swu, swd, seu, sed :: Octree a } |- Leaf { unLeaf :: [(Vector3, a)] } deriving (Show)+ Leaf { unLeaf :: [(Vector3, a)] } deriving (Show, Functor, Foldable, Traversable) -- | 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.2+version: 0.5.3 stability: beta homepage: https://github.com/mgajda/octree package-url: http://hackage.haskell.org/package/octree@@ -8,6 +8,7 @@ category: Data license: BSD3 license-file: LICENSE+extra-source-files: changelog author: Michal J. Gajda copyright: Copyright by Michal J. Gajda '2012@@ -26,7 +27,7 @@ Library build-depends: base>=4.0 && < 4.8, AC-Vector >= 2.3.0, QuickCheck >= 2.4.0 exposed-modules: Data.Octree- other-modules: Data.Octree.Internal, Data.Octree.Instances+ other-modules: Data.Octree.Internal exposed: True extensions: ScopedTypeVariables
README.lhs view
@@ -2,7 +2,7 @@ ====== This is a simple Octree implementation in Haskell. -[](https://api.travis-ci.org/mgajda/octree.png)+[](https://www.travis-ci.org/mgajda/octree) To use simply: @@ -25,3 +25,6 @@ *For now it uses AC-Vector package for vectors, but I may change it to use Tensor package used by OpenGL package, if there is interest.* *So far I still wait for package with vector operations (like dot, cross producton, vector projection and rejection) on Tensor types.* +Official releases are on [Hackage](http://hackage.haskell.org/package/Octree).++This package is also a part of [Stackage](http://daniel-diaz.github.io/stackagelist/) - a stable subset of Hackage.
+ changelog view
@@ -0,0 +1,4 @@+-*-Changelog-*-++0.5.3 Apr 2014+ * Switched to automatically derived Functor, Foldable, Traversable
tests/test_Octree.hs view
@@ -2,7 +2,6 @@ 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)