Module

BetaCalendars.GridAlgebra.Grid

Package
purescript-betacalendars-grid-algebra
Repository
mateopedersen/purescript-betacalendars-grid-algebra

Pure month-grid construction and topology descriptions.

Natural grids use the smallest whole number of seven-day rows that can hold the month. Fixed grids always contain six rows. Adjacent dates are optional display context and never replace a current-month date.

#GridMode Source

data GridMode

Natural height or a fixed six-week calendar surface.

Constructors

Instances

#AdjacentPolicy Source

data AdjacentPolicy

Whether dates outside the displayed month are rendered in spare cells.

Constructors

Instances

#CellRelation Source

data CellRelation

The relationship of a cell's date to the displayed month.

Constructors

Instances

#GridCell Source

type GridCell = { date :: Maybe CivilDate, index :: Int, relation :: CellRelation }

One row-major cell in a month grid.

#MonthTopology Source

type MonthTopology = { days :: Int, firstWeekday :: Weekday, fixedCells :: Int, lastWeekday :: Weekday, leadingCells :: Int, month :: Month, naturalRows :: Int, trailingCells :: Int, year :: Year }

Structural facts about one month under one week origin.

#TopologySignature Source

newtype TopologySignature

Descriptive signature of a month's shape under a selected week origin. This package-specific tuple is useful for comparing shapes; it is not an external calendar standard.

Instances

#topologySignature Source

topologySignature :: MonthTopology -> WeekStart -> TopologySignature

Create this package's descriptive topology tuple.

#MonthGrid Source

type MonthGrid = { adjacentPolicy :: AdjacentPolicy, cells :: Array GridCell, columns :: Int, mode :: GridMode, month :: Month, rows :: Int, topology :: MonthTopology, weekStart :: WeekStart, year :: Year }

A complete dated month surface.

#monthTopology Source

monthTopology :: Year -> Month -> WeekStart -> MonthTopology

Compute month topology without allocating its cells.

#monthGrid Source

monthGrid :: Year -> Month -> WeekStart -> GridMode -> AdjacentPolicy -> MonthGrid

Build a row-major month grid for a validated year and month.

#currentMonthDays Source

currentMonthDays :: MonthGrid -> Int

The number of current-month cells in a grid.