Refactor modules
This commit is contained in:
+8
-1
@@ -1,9 +1,12 @@
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
--{-# LANGUAGE Strict #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Picture.Data
|
||||
where
|
||||
import Geometry.Data
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Control.DeepSeq
|
||||
import Data.Foldable
|
||||
--import qualified Data.List as L
|
||||
--import Data.Monoid
|
||||
@@ -29,6 +32,8 @@ data RenderType
|
||||
| Render22x4 {_unRender22x4 :: ((Point2,Point2),Point4)}
|
||||
| Render3x2 {_unRender3x2 :: (Point3,Point2)}
|
||||
| Render3x3 {_unRender3x3 :: (Point3,Point3)}
|
||||
deriving Generic
|
||||
instance NFData RenderType
|
||||
|
||||
type RGBA = (Float,Float,Float,Float)
|
||||
type Color = (Float,Float,Float,Float)
|
||||
@@ -47,11 +52,13 @@ instance Functor FTree where
|
||||
fmap f (FBranches ts) = FBranches $ fmap (fmap f) ts
|
||||
fmap f (FLeaf x) = FLeaf (f x)
|
||||
{-# INLINE fmap #-}
|
||||
|
||||
|
||||
{- Tree with values at and only at the leaves. -}
|
||||
data LTree a
|
||||
= LBranches [LTree a]
|
||||
| LLeaf a
|
||||
deriving (Generic)
|
||||
instance NFData a => NFData (LTree a)
|
||||
instance Foldable LTree where
|
||||
foldMap g (LBranches ts) = mconcat $ map (foldMap g) ts
|
||||
foldMap g (LLeaf a) = g a
|
||||
|
||||
Reference in New Issue
Block a user