<commit_before>-- | Data definitions for L-seed
module Lseed.Data where 

import Data.Foldable (Foldable, foldMap)
import Data.Traversable (Traversable, sequenceA)
import Control.Applicative ((<$>),(<*>),pure)
import Control.Arrow (second)
import Data.Monoid
import System.Time (ClockTime)
import Data.Monoid

-- | User Tag
type UserTag = String

-- | Light angle
type Angle = Double

-- | A list of plants, together with their position in the garden, in the interval [0,1]
type Garden a = [ Planted a ]

-- | Named variants of a garden, for more expressive type signatures
type GrowingGarden = Garden GrowthState
type AnnotatedGarden = Garden StipeInfo

-- | A plant with metainformatoin
data Planted a = Planted
	{ plantPosition :: Double -- ^ Position in the garden, interval [0,1]
	, plantOwner    :: Integer -- ^ Id of the user that owns this plant
	, plantOwnerName:: String -- ^ Name of the owner of the plant
	, genome        :: GrammarFile -- ^ Lsystem in use
	, phenotype     :: Plant a -- ^ Actual current form of the plant
	}
	deriving (Show)

-- | Named variants of a Planted, for more expressive type signatures
type GrowingPlanted = Planted GrowthState
type AnnotatedPlanted = Planted StipeInfo

-- | A plant, which is
data Plant a 
	-- | a stipe with a length (factor of stipeLength), an angle relative
	-- to the parent stipe and a list of plants sprouting at the end
	= Plant { pData :: a
		, pLength :: Double
		, pAngle :: Angle
		, pUserTag :: UserTag
		, pBranches :: [ Plant a ]
		}
	deriving (Show)

-- | A straight, untagged plant with length zero and no branches.
inititalPlant = Plant () 0 0 "" []

data StipeInfo = StipeInfo
	{ siLength    :: Double -- ^ a bit redundant, but what shells
	, siSubLength :: Double
	, siLight     :: Double
	, siSubLight  :: Double
	, siAngle     :: Angle
	, siDirection :: Angle
	, siGrowth    :: GrowthState
	, siOffset    :: Double -- ^ Sideways position, relative to Plant origin
	, siHeight    :: Double -- ^ Vertical distance from bottom
	}
	deriving (Show)

-- | A GrowingPlant can be growing in one of these three ways:
data GrowthState = NoGrowth
		 | EnlargingTo Double -- ^ value indicates the growth target 
		 | GrowingSeed Double -- ^ value indicates the current state [0..1]
	deriving (Show)
<commit_msg>More sensible ordering of fields<commit_after>-- | Data definitions for L-seed
module Lseed.Data where 

import Data.Foldable (Foldable, foldMap)
import Data.Traversable (Traversable, sequenceA)
import Control.Applicative ((<$>),(<*>),pure)
import Control.Arrow (second)
import Data.Monoid
import System.Time (ClockTime)
import Data.Monoid

-- | User Tag
type UserTag = String

-- | Light angle
type Angle = Double

-- | A list of plants, together with their position in the garden, in the interval [0,1]
type Garden a = [ Planted a ]

-- | Named variants of a garden, for more expressive type signatures
type GrowingGarden = Garden GrowthState
type AnnotatedGarden = Garden StipeInfo

-- | A plant with metainformatoin
data Planted a = Planted
	{ plantPosition :: Double -- ^ Position in the garden, interval [0,1]
	, plantOwner    :: Integer -- ^ Id of the user that owns this plant
	, plantOwnerName:: String -- ^ Name of the owner of the plant
	, genome        :: GrammarFile -- ^ Lsystem in use
	, phenotype     :: Plant a -- ^ Actual current form of the plant
	}
	deriving (Show)

-- | Named variants of a Planted, for more expressive type signatures
type GrowingPlanted = Planted GrowthState
type AnnotatedPlanted = Planted StipeInfo

-- | A plant, which is
data Plant a 
	-- | a stipe with a length (factor of stipeLength), an angle relative
	-- to the parent stipe and a list of plants sprouting at the end
	= Plant { pData :: a
		, pLength :: Double
		, pAngle :: Angle
		, pUserTag :: UserTag
		, pBranches :: [ Plant a ]
		}
	deriving (Show)

-- | A straight, untagged plant with length zero and no branches.
inititalPlant = Plant () 0 0 "" []

data StipeInfo = StipeInfo
	{ siLength    :: Double -- ^ a bit redundant, but what shells
	, siSubLength :: Double
	, siLight     :: Double
	, siSubLight  :: Double
	, siAngle     :: Angle
	, siDirection :: Angle
	, siOffset    :: Double -- ^ Sideways position, relative to Plant origin
	, siHeight    :: Double -- ^ Vertical distance from bottom
	, siGrowth    :: GrowthState
	}
	deriving (Show)

-- | A GrowingPlant can be growing in one of these three ways:
data GrowthState = NoGrowth
		 | EnlargingTo Double -- ^ value indicates the growth target 
		 | GrowingSeed Double -- ^ value indicates the current state [0..1]
	deriving (Show)

{'fraction_non_alphanumeric': 0.09486338797814207, 'fraction_numerical': 0.0034972677595628415, 'mean_word_length': 3.362249761677788, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '575709', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1364, 'n_words': 554}