module Tile.Tile
  ( Tile (..),
    root,
    rootTile,
  )
where

import Tile.Affine
import Tile.Shape

newtype Tile = Tile
  { Tile -> AffineRankSpace
space :: AffineRankSpace
  }
  deriving (Int -> Tile -> ShowS
[Tile] -> ShowS
Tile -> String
(Int -> Tile -> ShowS)
-> (Tile -> String) -> ([Tile] -> ShowS) -> Show Tile
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Tile -> ShowS
showsPrec :: Int -> Tile -> ShowS
$cshow :: Tile -> String
show :: Tile -> String
$cshowList :: [Tile] -> ShowS
showList :: [Tile] -> ShowS
Show, Tile -> Tile -> Bool
(Tile -> Tile -> Bool) -> (Tile -> Tile -> Bool) -> Eq Tile
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Tile -> Tile -> Bool
== :: Tile -> Tile -> Bool
$c/= :: Tile -> Tile -> Bool
/= :: Tile -> Tile -> Bool
Eq)

root :: Tile -> Int
root :: Tile -> Int
root = AffineRankSpace -> Int
offset (AffineRankSpace -> Int)
-> (Tile -> AffineRankSpace) -> Tile -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Tile -> AffineRankSpace
space

rootTile :: Shape -> Tile
rootTile :: Shape -> Tile
rootTile = AffineRankSpace -> Tile
Tile (AffineRankSpace -> Tile)
-> (Shape -> AffineRankSpace) -> Shape -> Tile
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Shape -> AffineRankSpace
rowMajor