{-# LANGUAGE FlexibleInstances #-} module Hdoc.TCT.Cell ( module Hdoc.TCT.Cell , XML.FileRange(..) , XML.FilePos(..) , XML.NoSource(..) , XML.Sourced(..) ) where import Data.List.NonEmpty (NonEmpty(..)) import Prelude (Int) import qualified Language.Symantic.XML as XML -- * Type 'Pos' -- | Absolute text file position. type Pos = XML.FilePos {- instance Semigroup Pos where Pos lx cx <> Pos ly cy = Pos (lx+ly) (cx+cy) instance Monoid Pos where mempty = Pos 0 0 mappend = (<>) -} pos1 :: Pos pos1 = XML.filePos1 -- ** Type 'LineNum' type LineNum = Int -- ** Type 'ColNum' type ColNum = Int -- * Type 'Cell' type Cell = XML.Sourced Location {- instance (FromPad a, Semigroup a, Monoid a) => Monoid (Cell a) where mempty = cell0 mempty mappend = (<>) -} cell0 :: a -> Cell a cell0 = XML.Sourced (XML.FileRange "" filePos0 filePos0 :| []) where filePos0 = XML.FilePos 0 0 -- ** Type 'Span' type Span = XML.FileRange -- ** Type 'Location' type Location = XML.FileSource